Struct Axis
- Namespace
- CADability
- Assembly
- CADability.dll
An axis given by a location and a direction. There is no orientation for an
x-direction or y-direction. If you need that use CoordSys
[JsonVersion(serializeAsStruct = true, version = 1)]
public struct Axis : ISerializable, IJsonSerialize
- Implements
- Inherited Members
Constructors
Axis(GeoPoint, GeoPoint)
Creates a new axis from two points
public Axis(GeoPoint StartPoint, GeoPoint EndPoint)
Parameters
Axis(GeoPoint, GeoVector)
Creates a new axis from a location and a direction
public Axis(GeoPoint location, GeoVector direction)
Parameters
Axis(IJsonReadStruct)
Constructor for the JSON deserialization (IJsonSerialize): reads the location and the direction in the order GetObjectData(IJsonWriteData) wrote them. It is found by reflection, there is no need to call it directly.
public Axis(IJsonReadStruct data)
Parameters
dataIJsonReadStructsupplies the values
Axis(SerializationInfo, StreamingContext)
Constructor required by deserialization
public Axis(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInfoSerializationInfo
contextStreamingContextStreamingContext
Fields
Direction
The direction of the axis
public GeoVector Direction
Field Value
Location
An arbitrary location of the axis
public GeoPoint Location
Field Value
Properties
InvalidAxis
An axis marked as invalid: its Location is Invalid and its Direction the nullvector. Returned by methods that could not determine an axis; test with IsValid.
public static Axis InvalidAxis { get; }
Property Value
IsValid
True, when the Location is a valid point (see IsValid), false for InvalidAxis. The direction is not checked.
public bool IsValid { get; }
Property Value
Methods
Clip(BoundingCube)
Returns the part of this infinite axis inside the given cube as a Line object, e.g. to display the axis of a cylinder within the extent of a model. If the axis does not pass through the cube, the returned line is degenerate (both points at the origin).
public Line Clip(BoundingCube ext)
Parameters
extBoundingCubethe cube to clip with
Returns
- Line
the clipped axis as a line
Distance(GeoPoint)
Returns the perpendicular distance of the point to the infinite line of this axis. The result is never negative. If the direction is the nullvector, the distance to Location is returned.
public double Distance(GeoPoint p)
Parameters
pGeoPointthe point
Returns
- double
the distance
GetObjectData(IJsonWriteData)
Writes the location and the direction for the JSON serialization (IJsonSerialize). The struct is serialized inline as a plain list of values and read back by the constructor taking an IJsonReadStruct.
public void GetObjectData(IJsonWriteData data)
Parameters
dataIJsonWriteDatareceives the values
GetObjectData(SerializationInfo, StreamingContext)
Writes the data of this object for the legacy binary serialization (ISerializable). Files are written in the JSON format (IJsonSerialize) now; the binary format is still read.
public void GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
infoSerializationInforeceives the data
contextStreamingContextthe destination of the serialization
SameGeometry(Axis)
Determines whether the other axis describes the same infinite line: the directions are parallel within
epsa (opposite orientation counts as parallel) and the location of other
lies on this axis within eps. See also SameAxis(Axis, Axis).
public bool SameGeometry(Axis other)
Parameters
otherAxisthe axis to compare with
Returns
- bool
true if both axes are geometrically the same line
SetObjectData(IJsonReadData)
Does nothing. Value types serialized inline are restored by the constructor taking an IJsonReadStruct; this method only exists to satisfy IJsonSerialize.
public void SetObjectData(IJsonReadData data)
Parameters
dataIJsonReadDatanot used