Struct Plane
A simple plane as a value type. Is used e.g. as a drawing plane, an intersection plane etc. It also serves as a coordinate system (see CoordSys).
Inherited Members
Namespace: CADability
Assembly: CADability.dll
Syntax
[Serializable]
[JsonVersion(serializeAsStruct = true, version = 1)]
public struct Plane : ISerializable, IJsonSerialize
Constructors
| Improve this Doc View SourcePlane(GeoPoint, GeoPoint, GeoPoint)
Creates a new plane with the given parameters. Throws a PlaneException, if the three points are colinear
Declaration
public Plane(GeoPoint Location, GeoPoint p1, GeoPoint p2)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | Location | location of the plane |
| GeoPoint | p1 | specifies the direction of the x-axis |
| GeoPoint | p2 | specifies the direction of the y-axis, wich will be perpendicular to the x-axis |
Plane(GeoPoint, GeoVector)
Creates a new plane. The parameter data is under-determined for the plane, so the x-axis and y-axis will be determined arbitrarily
Declaration
public Plane(GeoPoint Location, GeoVector Normal)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | Location | location of the plane |
| GeoVector | Normal | normal vector of the plane |
Plane(GeoPoint, GeoVector, GeoVector)
Creates a new plane with the given parameters. Throws a PlaneException, if DirectionX
and DirectionY have the same direction.
Declaration
public Plane(GeoPoint Location, GeoVector DirectionX, GeoVector DirectionY)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | Location | location of the plane |
| GeoVector | DirectionX | direction of the x-axis |
| GeoVector | DirectionY | direction of the y-axis, will be adapted if not perpendicular to the x-axis |
Plane(IJsonReadStruct)
Declaration
public Plane(IJsonReadStruct data)
Parameters
| Type | Name | Description |
|---|---|---|
| IJsonReadStruct | data |
Plane(Plane)
Declaration
public Plane(Plane basePlane)
Parameters
| Type | Name | Description |
|---|---|---|
| Plane | basePlane |
Plane(Plane, Double)
Declaration
public Plane(Plane basePlane, double offset)
Parameters
| Type | Name | Description |
|---|---|---|
| Plane | basePlane | |
| System.Double | offset |
Plane(Plane.StandardPlane, Double)
Creates a new plane parallel to a Plane.StandardPlane with a given offset
Declaration
public Plane(Plane.StandardPlane std, double offset)
Parameters
| Type | Name | Description |
|---|---|---|
| Plane.StandardPlane | std | the standard plane |
| System.Double | offset | the offset to the standard plane |
Plane(SerializationInfo, StreamingContext)
Constructor required by deserialization
Declaration
public Plane(SerializationInfo info, StreamingContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Runtime.Serialization.SerializationInfo | info | SerializationInfo |
| System.Runtime.Serialization.StreamingContext | context | StreamingContext |
Fields
| Improve this Doc View SourceXYPlane
Returns the X/Y plane.
Declaration
public static readonly Plane XYPlane
Field Value
| Type | Description |
|---|---|
| Plane |
XZPlane
Returns the X/Z plane.
Declaration
public static readonly Plane XZPlane
Field Value
| Type | Description |
|---|---|
| Plane |
YZPlane
Returns the Y/Z plane.
Declaration
public static readonly Plane YZPlane
Field Value
| Type | Description |
|---|---|
| Plane |
Properties
| Improve this Doc View SourceCoordSys
Returns the coordinate system corresponding to this plane. The z-axis of the coordinate system is the normal vector of this plane (always right handed)
Declaration
public CoordSys CoordSys { get; }
Property Value
| Type | Description |
|---|---|
| CoordSys |
DirectionX
Gets or sets the direction of the x-axis of this plane. Setting the x-axis results in a reculculation of the y-axis to make the axis perpendicular.
Declaration
public GeoVector DirectionX { get; set; }
Property Value
| Type | Description |
|---|---|
| GeoVector |
DirectionY
Gets or sets the direction of the y-axis of this plane. Setting the y-axis results in a reculculation of the x-axis to make the axis perpendicular.
Declaration
public GeoVector DirectionY { get; set; }
Property Value
| Type | Description |
|---|---|
| GeoVector |
Location
Gets or sets the location of this plane
Declaration
public GeoPoint Location { get; set; }
Property Value
| Type | Description |
|---|---|
| GeoPoint |
ModOpToGlobal
Declaration
public ModOp ModOpToGlobal { get; }
Property Value
| Type | Description |
|---|---|
| ModOp |
Normal
Gets or sets the normal vector of this plane. Setting the normal vector results in a recalculation of the x-axis and y-axis of this plane
Declaration
public GeoVector Normal { get; set; }
Property Value
| Type | Description |
|---|---|
| GeoVector |
Methods
| Improve this Doc View SourceAlign(GeoPoint2D)
Declaration
public void Align(GeoPoint2D c)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D | c |
Align(Plane, Boolean)
Aligns the DirectionX and DirectionY vectors of this plane so that the projection of DirectionX of AlignTo and DircetionX of this plane are parallel. If the two planes are parallel, the DirectionX and DirectionY of both planes will also be parallel. The plane will not be changed. The Location of this plane will be changed to a point closest to the location of AlignTo, if relocate is true, otherwise the location remains unchanged.
Declaration
public void Align(Plane alignTo, bool relocate)
Parameters
| Type | Name | Description |
|---|---|---|
| Plane | alignTo | |
| System.Boolean | relocate | relocate this plane |
Align(Plane, Boolean, Boolean)
Aligns the DirectionX and DirectionY vectors of this plane
so that the projection of DirectionX of AlignTo and DircetionX of this plane are parallel.
If the two planes are parallel, the DirectionX and DirectionY of both planes will
also be parallel. The plane will not be changed. The Location of this
plane will be changed to a point closest to the location of AlignTo, if relocate
is true, otherwise the location remains unchanged. If flip is true
there is an additional check whether the angle between the two normal vectors is less than
90°. If not, the y-axis is reversed and the angle between the two normal vectors will be
less than 90°
Declaration
public void Align(Plane alignTo, bool relocate, bool flip)
Parameters
| Type | Name | Description |
|---|---|---|
| Plane | alignTo | Plane to align to |
| System.Boolean | relocate | relocate this plane |
| System.Boolean | flip |
Distance(GeoPoint)
Returns the signed distance of the point from the plane. The direction of the normal vector of the plane determins the sign of the result.
Declaration
public double Distance(GeoPoint p)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | p | the point |
Returns
| Type | Description |
|---|---|
| System.Double | the distance |
Elem(GeoPoint)
Declaration
public bool Elem(GeoPoint g)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | g |
Returns
| Type | Description |
|---|---|
| System.Boolean |
FromPoints(GeoPoint[], out Double, out Boolean)
Finds a plane that best fits through the given points. Calculates also the maximum distance
of the points from that plane. If MaxDistance is 0.0 or small, the points are coplanar.
Declaration
public static Plane FromPoints(GeoPoint[] Points, out double MaxDistance, out bool isLinear)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint[] | Points | points to build the plane from |
| System.Double | MaxDistance | maximum distance of the points from the plane |
| System.Boolean | isLinear |
Returns
| Type | Description |
|---|---|
| Plane | the plane |
GetProjection()
Returns a projection that projects (perpendiccular) from global space to this plane
Declaration
public Projection GetProjection()
Returns
| Type | Description |
|---|---|
| Projection | the projection |
Interfere(GeoPoint, GeoPoint)
Declaration
public GeoPoint[] Interfere(GeoPoint sp, GeoPoint ep)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | sp | |
| GeoPoint | ep |
Returns
| Type | Description |
|---|---|
| GeoPoint[] |
Intersect(GeoPoint, GeoVector)
Returns the intersection plane of the line given by the parameters with this plane.
Declaration
public GeoPoint Intersect(GeoPoint LinePoint, GeoVector LineDir)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | LinePoint | point on the line |
| GeoVector | LineDir | direction of the line |
Returns
| Type | Description |
|---|---|
| GeoPoint |
Intersect(GeoPoint, GeoVector, out GeoPoint)
Declaration
public bool Intersect(GeoPoint LinePoint, GeoVector LineDir, out GeoPoint ip)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | LinePoint | |
| GeoVector | LineDir | |
| GeoPoint | ip |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Intersect(Plane, out GeoPoint, out GeoVector)
Declaration
public bool Intersect(Plane other, out GeoPoint loc, out GeoVector dir)
Parameters
| Type | Name | Description |
|---|---|---|
| Plane | other | |
| GeoPoint | loc | |
| GeoVector | dir |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Intersect3Planes(GeoPoint, GeoVector, GeoPoint, GeoVector, GeoPoint, GeoVector, out GeoPoint)
Declaration
public static bool Intersect3Planes(GeoPoint loc1, GeoVector norm1, GeoPoint loc2, GeoVector norm2, GeoPoint loc3, GeoVector norm3, out GeoPoint ip)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | loc1 | |
| GeoVector | norm1 | |
| GeoPoint | loc2 | |
| GeoVector | norm2 | |
| GeoPoint | loc3 | |
| GeoVector | norm3 | |
| GeoPoint | ip |
Returns
| Type | Description |
|---|---|
| System.Boolean |
IsValid()
An uninitialized plane is invalid, because its normal vector is (0,0,0).
Declaration
public bool IsValid()
Returns
| Type | Description |
|---|---|
| System.Boolean |
Modify(ModOp)
Declaration
public void Modify(ModOp m)
Parameters
| Type | Name | Description |
|---|---|---|
| ModOp | m |
Offset(Double)
Returns a plane parallel to this plane with the given offset
Declaration
public Plane Offset(double dist)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Double | dist | the offset |
Returns
| Type | Description |
|---|---|
| Plane | the parallel plane |
Project(GeoPoint)
Projects the given point (perpendicular) onto this plane and returns the two-dimensional point as expressed in the coordinate system of this plane.
Declaration
public GeoPoint2D Project(GeoPoint p)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | p | the point |
Returns
| Type | Description |
|---|---|
| GeoPoint2D | the point in the coordinate system of this plane |
Project(GeoPoint[])
Projects the given point (perpendicular) onto this plane and returns the two-dimensional point as expressed in the coordinate system of this plane.
Declaration
public GeoPoint2D[] Project(GeoPoint[] p)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint[] | p | the point |
Returns
| Type | Description |
|---|---|
| GeoPoint2D[] | the point in the coordinate system of this plane |
Project(GeoVector)
Projects the given vector (perpendicular) onto this plane and returns the two-dimensional vector as expressed in the coordinate system of this plane.
Declaration
public GeoVector2D Project(GeoVector v)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | v | the vector |
Returns
| Type | Description |
|---|---|
| GeoVector2D | the vector in the coordinate system of this plane |
Reverse()
Declaration
public void Reverse()
ToGlobal(GeoPoint)
Inverse to the appropriate ToLocal(GeoPoint) method. The given point is assumed in the coordinate ststem of this plane. Returns the point in the global coordinate system.
Declaration
public GeoPoint ToGlobal(GeoPoint p)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | p | point in the plane coordinate system |
Returns
| Type | Description |
|---|---|
| GeoPoint | point in the global coordinate system |
ToGlobal(GeoPoint2D)
Inverse to the appropriate Project(GeoPoint) method. Returns the point in the global coordinate system
Declaration
public GeoPoint ToGlobal(GeoPoint2D p)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint2D | p | 2d point in the local system of this plane |
Returns
| Type | Description |
|---|---|
| GeoPoint | 3d point in the global coordinate system |
ToGlobal(GeoVector)
Returns the 3D GeoVector corresponding to the given GeoVector in the coordinate system of the plane.
Declaration
public GeoVector ToGlobal(GeoVector v)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | v | a vector in the coordinate system of the plane |
Returns
| Type | Description |
|---|---|
| GeoVector | a 3D vector in the global coordinate system |
ToGlobal(GeoVector2D)
Inverse to the appropriate Project(GeoVector) method. Returns the vector in the global coordinate system
Declaration
public GeoVector ToGlobal(GeoVector2D v)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector2D | v | 2d vector in the coordinate system of the plane |
Returns
| Type | Description |
|---|---|
| GeoVector | 3d vector in the global coordinate system |
ToLocal(GeoPoint)
Returns the point as expressed in the coordinate system of this plane
Declaration
public GeoPoint ToLocal(GeoPoint p)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoPoint | p | point (in the global system) |
Returns
| Type | Description |
|---|---|
| GeoPoint | point in the local system of this plane |
ToLocal(GeoVector)
Returns the vector as expressed in the coordinate system of this plane
Declaration
public GeoVector ToLocal(GeoVector v)
Parameters
| Type | Name | Description |
|---|---|---|
| GeoVector | v | vector (in the global system) |
Returns
| Type | Description |
|---|---|
| GeoVector | vector in the local system of this plane |
ToLocal(Plane)
Returns the plane given in parameter p expressed in the coordinate system of this plane
Declaration
public Plane ToLocal(Plane p)
Parameters
| Type | Name | Description |
|---|---|---|
| Plane | p | plane in global system |
Returns
| Type | Description |
|---|---|
| Plane | plane in local system |
Explicit Interface Implementations
| Improve this Doc View SourceIJsonSerialize.GetObjectData(IJsonWriteData)
Declaration
void IJsonSerialize.GetObjectData(IJsonWriteData data)
Parameters
| Type | Name | Description |
|---|---|---|
| IJsonWriteData | data |
IJsonSerialize.SetObjectData(IJsonReadData)
Declaration
void IJsonSerialize.SetObjectData(IJsonReadData data)
Parameters
| Type | Name | Description |
|---|---|---|
| IJsonReadData | data |
ISerializable.GetObjectData(SerializationInfo, StreamingContext)
Declaration
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Runtime.Serialization.SerializationInfo | info | |
| System.Runtime.Serialization.StreamingContext | context |