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)
public Flat3d(IFlat3d src)
Parameters
src
IFlat3d
Flat3d(Vec3d, double)
Initializes a new instance of the Flat3d class with a normal vector and distance to origin.
public Flat3d(Vec3d normal, double distanceToOrigin)
Parameters
normal
Vec3dThe unit normal vector of the plane.
distanceToOrigin
doubleThe 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.
public Vec3d Normal { get; set; }
Property Value
Methods
DistanceTo(Vec3d)
Gets the distance from a point to this plane.
public double DistanceTo(Vec3d point)
Parameters
point
Vec3dThe 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
other
Flat3dAn 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
obj
objectThe object to compare with the current object.
Returns
FromPointAndNormal(Vec3d, Vec3d)
Creates a plane from a point and normal vector.
public static Flat3d FromPointAndNormal(Vec3d point, Vec3d 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 GetLocate()
Returns
GetNormal()
Gets the normal vector of the flat surface.
public Vec3d GetNormal()
Returns
- Vec3d
The unit normal vector
ProjectPoint(Vec3d)
Projects a point onto this plane.
public Vec3d ProjectPoint(Vec3d point)
Parameters
point
Vec3dThe point to project.
Returns
- Vec3d
The projected point on the plane.
ReadBin(BinaryReader)
Reads binary data to initialize the object.
public void ReadBin(BinaryReader reader)
Parameters
reader
BinaryReaderThe 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
writer
BinaryWriterThe binary writer to write to