Class Plane
A plane is simply an origin point and normal.
public class Plane : IGeometry<Plane>, IEquatable<Plane>, ITransformable<Plane>
public Plane()
Constructs a plane from another plane.
public Plane(Plane plane)
Type | Name | Description |
---|---|---|
Plane | plane | Input plane. |
Constructs a plane from three non-collinear points.
public Plane(Point3 pt1, Point3 pt2, Point3 pt3)
Type | Name | Description |
---|---|---|
Point3 | pt1 | Firs point representing the origin. |
Point3 | pt2 | Second point representing the x direction. |
Point3 | pt3 | Third point representing the y direction. |
Constructs a plane from a origin and a direction.
public Plane(Point3 origin, Vector3 direction)
Type | Name | Description |
---|---|---|
Point3 | origin | The point describing the origin of the plane. |
Vector3 | direction | The vector representing the normal of the plane. |
Constructs a plane from an point and two directions.
public Plane(Point3 origin, Vector3 xDirection, Vector3 yDirection)
Type | Name | Description |
---|---|---|
Point3 | origin | Point representing the origin. |
Vector3 | xDirection | X direction. |
Vector3 | yDirection | Y direction. |
Returns true if origin and axis vectors are valid and orthogonal.
public bool IsValid { get; }
Type | Description |
---|---|
System.Boolean |
Gets the origin of the plane.
public Point3 Origin { get; set; }
Type | Description |
---|---|
Point3 |
Gets a XY plane.
public static Plane PlaneXY { get; }
Type | Description |
---|---|
Plane |
Gets a YZ plane.
public static Plane PlaneYZ { get; }
Type | Description |
---|---|
Plane |
Gets a XY plane.
public static Plane PlaneZX { get; }
Type | Description |
---|---|
Plane |
Gets a plane whose components are Unset.
public static Plane Unset { get; }
Type | Description |
---|---|
Plane |
Gets the XAxis of the plane.
public Vector3 XAxis { get; set; }
Type | Description |
---|---|
Vector3 |
Gets the YAxis of the plane.
public Vector3 YAxis { get; set; }
Type | Description |
---|---|
Vector3 |
Gets the normal of the plane.
public Vector3 ZAxis { get; }
Type | Description |
---|---|
Vector3 |
Performs the rotation to align the XAxis of a plane to a given guide vector.
public Plane Align(Vector3 direction)
Type | Name | Description |
---|---|---|
Vector3 | direction | The guide vector. |
Type | Description |
---|---|
Plane | The rotated plane (in radians) with XAxis align to the guide vector. |
Calculates the parameters of a point on the plane closest to the test point.
public (double u, double v) ClosestParameters(Point3 pt)
Type | Name | Description |
---|---|---|
Point3 | pt | Test point, the point to get close to. |
Type | Description |
---|---|
System.ValueTuple<System.Double, System.Double> | The u parameter is along X-direction and v parameter is along the Y-direction. |
Finds the closest point on a plane. https://www.parametriczoo.com/index.php/2020/02/29/signed-distance-of-a-point-from-a-plane/
public Point3 ClosestPoint(Vector3 pt, out double distance)
Type | Name | Description |
---|---|---|
Vector3 | pt | The point to test. |
System.Double | distance | The signed distance of point from the plane. If the point is above the plane (positive side) the result is positive, if the point is below the result is negative. |
Type | Description |
---|---|
Point3 | The point on the plane that is closest to the sample point. |
Returns a boolean indicating whether the given Plane is equal to this Plane instance.
The plane are equals if they have same origin and axises.
public bool Equals(Plane other)
Type | Name | Description |
---|---|---|
Plane | other | The Plane to compare this instance to. |
Type | Description |
---|---|
System.Boolean | True if the other Plane is equal to this instance; False otherwise. |
Fits a plane through a set of points. http://www.ilikebigbits.com/2015_03_04_plane_from_points.html
public static Plane FitPlane(IList<Point3> pts, out double deviation)
Type | Name | Description |
---|---|---|
System.Collections.Generic.IList<Point3> | pts | Points to fit. |
System.Double | deviation | Maximum deviation between the points and the plane. |
Type | Description |
---|---|
Plane | The defined plane generated. |
Flip plane by swapping X and Y axes.
public Plane Flip()
Type | Description |
---|---|
Plane | The flipped plane. |
Returns the hash code for this instance.
public override int GetHashCode()
Type | Description |
---|---|
System.Int32 | The hash code of the plane. |
Evaluates a point on the plane.
public Point3 PointAt(double u, double v)
Type | Name | Description |
---|---|---|
System.Double | u | Evaluation parameter. |
System.Double | v | Evaluation parameter. |
Type | Description |
---|---|
Point3 | The evaluated point. |
Rotates the plane around is own Z-axis.
public Plane Rotate(double radiansAngle)
Type | Name | Description |
---|---|---|
System.Double | radiansAngle | Angle to rotate the plane, expressed in radians. |
Type | Description |
---|---|
Plane | The plan rotated. |
Changes the origin of a plane.
public Plane SetOrigin(Point3 origin)
Type | Name | Description |
---|---|---|
Point3 | origin | The new origin point of a plane. |
Type | Description |
---|---|
Plane | The plane with the new origin. |
Translate a plane into a readable format.
public override string ToString()
Type | Description |
---|---|
System.String | The text format of a plane. |
Transforms the plane by a transformation matrix.
public Plane Transform(TransformMatrix t)
Type | Name | Description |
---|---|---|
TransformMatrix | t | The transformation matrix to apply to the plane. |
Type | Description |
---|---|
Plane | The transformed plane. |