Class Flat3d
Represents a 3D plane defined by a unit normal vector and its signed distance from the origin. The plane equation is: Ax + By + Cz + d = 0, where (A,B,C) is the normal vector and d is the distance to origin.
public class Flat3d : IFlat3d, IBinaryIo, IWriteBin, IEquatable<Flat3d>
- Inheritance
-
Flat3d
- Implements
- Inherited Members
- Extension Methods
Constructors
Flat3d()
Initializes a new instance of the Flat3d class.
public Flat3d()
Flat3d(IFlat3d)
Copy constructor.
public Flat3d(IFlat3d src)
Parameters
srcIFlat3dSource plane
Flat3d(vec3d_t, double)
Initializes a new instance of the Flat3d class with a normal vector and distance to origin.
public Flat3d(vec3d_t normal, double distanceToOrigin)
Parameters
normalvec3d_tThe unit normal vector of the plane.
distanceToOrigindoubleThe signed distance from origin to the plane.
Properties
DistanceToOrigin
The signed distance from the origin (0,0,0) to this plane. A positive distance means the origin is on the same side as the normal vector.
public double DistanceToOrigin { get; set; }
Property Value
Normal
The unit normal to the plane. Zero after the parameterless ctor until ReadBin(BinaryReader) or the setter assigns it; a zero normal is a plane that has not been set, not a valid plane.
public vec3d_t Normal { get; set; }
Property Value
Methods
DistanceTo(vec3d_t)
Gets the distance from a point to this plane.
public double DistanceTo(vec3d_t point)
Parameters
pointvec3d_tThe point to calculate distance to.
Returns
- double
The signed distance from the point to the plane.
Equals(Flat3d)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Flat3d other)
Parameters
otherFlat3dAn object to compare with this object.
Returns
Equals(object)
Determines whether the specified object is equal to the current object.
public override bool Equals(object obj)
Parameters
objobjectThe object to compare with the current object.
Returns
FromPointAndNormal(vec3d_t, vec3d_t)
Creates a plane from a point and normal vector.
public static Flat3d FromPointAndNormal(vec3d_t point, vec3d_t normal)
Parameters
Returns
- Flat3d
A new plane instance.
GetDistanceToOrigin()
Signed Distance To Origin.
public double GetDistanceToOrigin()
Returns
- double
Signed Distance To Origin.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
GetLocate()
Gets a point on the plane closest to the origin.
public vec3d_t GetLocate()
Returns
GetNormal()
Gets the normal vector of the flat surface.
public vec3d_t GetNormal()
Returns
- vec3d_t
The unit normal vector
ProjectPoint(vec3d_t)
Projects a point onto this plane.
public vec3d_t ProjectPoint(vec3d_t point)
Parameters
pointvec3d_tThe point to project.
Returns
- vec3d_t
The projected point on the plane.
ReadBin(BinaryReader)
Reads binary data to initialize the object.
public void ReadBin(BinaryReader reader)
Parameters
readerBinaryReaderThe binary reader to read from
ToString()
Returns a string representation of the plane.
public override string ToString()
Returns
WriteBin(BinaryWriter)
Writes the object's data to a binary stream.
public void WriteBin(BinaryWriter writer)
Parameters
writerBinaryWriterThe binary writer to write to