Struct PlaneD
Represents a plane in three-dimensional space.
public struct PlaneD : IEquatable<PlaneD>
- Implements
- Inherited Members
- Extension Methods
Remarks
Constructors
PlaneD(Vector3D, double)
Creates a PlaneD object from a specified normal and the distance along the normal from the origin.
public PlaneD(Vector3D normal, double d)
Parameters
normal
Vector3DThe plane's normal vector.
d
doubleThe plane's distance from the origin along its normal vector.
PlaneD(double, double, double, double)
Creates a PlaneD object from the X, Y, and Z components of its normal, and its distance from the origin on that normal.
public PlaneD(double x, double y, double z, double d)
Parameters
x
doubleThe X component of the normal.
y
doubleThe Y component of the normal.
z
doubleThe Z component of the normal.
d
doubleThe distance of the plane along its normal from the origin.
PlaneD(Vector4)
Creates a PlaneD object from a specified four-dimensional vector.
public PlaneD(Vector4 value)
Parameters
value
Vector4A vector whose first three elements describe the normal vector, and whose W defines the distance along that normal from the origin.
Fields
D
The distance of the plane along its normal from the origin.
public double D
Field Value
Normal
The normal vector of the plane.
public Vector3D Normal
Field Value
Methods
CreateFromVertices(Vector3D, Vector3D, Vector3D)
Creates a PlaneD object that contains three specified points.
public static PlaneD CreateFromVertices(Vector3D point1, Vector3D point2, Vector3D point3)
Parameters
point1
Vector3DThe first point defining the plane.
point2
Vector3DThe second point defining the plane.
point3
Vector3DThe third point defining the plane.
Returns
- PlaneD
The plane containing the three points.
DistanceTo(Vector3D)
Returns the shortest distance from this plane to the position point
.
public readonly double DistanceTo(Vector3D point)
Parameters
point
Vector3DThe position to use for the calculation.
Returns
- double
The shortest distance.
Dot(PlaneD, Vector4)
Calculates the dot product of a plane and a 4-dimensional vector.
public static double Dot(PlaneD plane, Vector4 value)
Parameters
Returns
- double
The dot product.
Dot(Vector4)
public double Dot(Vector4 with)
Parameters
with
Vector4
Returns
DotCoordinate(PlaneD, Vector3D)
Returns the dot product of a specified three-dimensional vector and the normal vector of this plane plus the distance (D) value of the plane.
public static double DotCoordinate(PlaneD plane, Vector3D value)
Parameters
Returns
- double
The dot product.
DotNormal(PlaneD, Vector3D)
Returns the dot product of a specified three-dimensional vector and the Normal vector of this plane.
public static double DotNormal(PlaneD plane, Vector3D value)
Parameters
Returns
- double
The dot product.
Equals(PlaneD)
Returns a value that indicates whether this instance and another plane object are equal.
public readonly bool Equals(PlaneD other)
Parameters
other
PlaneDThe other plane.
Returns
Remarks
Equals(object?)
Returns a value that indicates whether this instance and a specified object are equal.
public override readonly bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current instance.
Returns
- bool
true if the current instance and
obj
are equal; otherwise, false. Ifobj
is null, the method returns false.
Remarks
The current instance and obj
are equal if obj
is a PlaneD object and their Normal and D fields are equal.
GetCenter()
Returns the center of the plane, the point on the plane closest to the origin. The point where the normal line going through the origin intersects the plane.
public readonly Vector3D GetCenter()
Returns
GetHashCode()
Returns the hash code for this instance.
public override readonly int GetHashCode()
Returns
- int
The hash code.
HasPoint(Vector3D, double)
Returns true if point is inside the plane. Comparison uses a custom minimum tolerance threshold.
public readonly bool HasPoint(Vector3D point, double tolerance = 5E-324)
Parameters
Returns
Intersect3(PlaneD, PlaneD)
Returns the intersection point of the three planes: b
, c
,
and this plane. If no intersection is found, null is returned.
public readonly Vector3D? Intersect3(PlaneD b, PlaneD c)
Parameters
b
PlaneDOne of the three planes to use in the calculation.
c
PlaneDOne of the three planes to use in the calculation.
Returns
IntersectsRay(Vector3D, Vector3D)
Returns the intersection point of a ray consisting of the position from
and the direction normal dir
with this plane.
If no intersection is found, null is returned.
public readonly Vector3D? IntersectsRay(Vector3D from, Vector3D dir)
Parameters
Returns
IntersectsSegment(Vector3D, Vector3D)
Returns the intersection point of a line segment from
position begin
to position end
with this plane.
If no intersection is found, null is returned.
public readonly Vector3D? IntersectsSegment(Vector3D begin, Vector3D end)
Parameters
Returns
IsFinite()
Returns true if this plane is finite, by calling IsFinite(float) on each component.
public readonly bool IsFinite()
Returns
- bool
Whether this vector is finite or not.
IsPointOver(Vector3D)
Returns true if point
is located above the plane.
public readonly bool IsPointOver(Vector3D point)
Parameters
point
Vector3DThe point to check.
Returns
Normalize(PlaneD)
Creates a new PlaneD object whose normal vector is the source plane's normal vector normalized.
public static PlaneD Normalize(PlaneD value)
Parameters
value
PlaneDThe source plane.
Returns
- PlaneD
The normalized plane.
Normalized()
Returns the plane scaled to unit length.
public readonly PlaneD Normalized()
Returns
- PlaneD
A normalized version of the plane.
Project(Vector3D)
Returns the orthogonal projection of point
into the plane.
public readonly Vector3D Project(Vector3D point)
Parameters
point
Vector3DThe point to project.
Returns
- Vector3D
The projected point.
ToString()
Returns the string representation of this plane object.
public override readonly string ToString()
Returns
Remarks
The string representation of a PlaneD object use the formatting conventions of the current culture to format the numeric values in the returned string. For example, a PlaneD object whose string representation is formatted by using the conventions of the en-US culture might appear as {Normal:<1.1, 2.2, 3.3> D:4.4}
.
Transform(PlaneD, Matrix4x4)
Transforms a normalized plane by a 4x4 matrix.
public static PlaneD Transform(PlaneD plane, Matrix4x4 matrix)
Parameters
plane
PlaneDThe normalized plane to transform.
matrix
Matrix4x4The transformation matrix to apply to
plane
.
Returns
- PlaneD
The transformed plane.
Remarks
plane
must already be normalized so that its Normal vector is of unit length before this method is called.
Transform(PlaneD, Quaternion)
Transforms a normalized plane by a Quaternion rotation.
public static PlaneD Transform(PlaneD plane, Quaternion rotation)
Parameters
plane
PlaneDThe normalized plane to transform.
rotation
QuaternionThe Quaternion rotation to apply to the plane.
Returns
- PlaneD
A new plane that results from applying the Quaternion rotation.
Remarks
plane
must already be normalized so that its Normal vector is of unit length before this method is called.
Operators
operator ==(PlaneD, PlaneD)
Returns a value that indicates whether two planes are equal.
public static bool operator ==(PlaneD value1, PlaneD value2)
Parameters
Returns
Remarks
Two PlaneD objects are equal if their Normal and D fields are equal. The operator ==(PlaneD, PlaneD) method defines the operation of the equality operator for PlaneD objects.
operator !=(PlaneD, PlaneD)
Returns a value that indicates whether two planes are not equal.
public static bool operator !=(PlaneD value1, PlaneD value2)
Parameters
Returns
Remarks
The operator !=(PlaneD, PlaneD) method defines the operation of the inequality operator for PlaneD objects.