Class Segment3d
Represents a 3D line segment defined by two endpoints.
public class Segment3d : IExpandToBox3d, IEquatable<Segment3d>, IBinaryIo, IWriteBin, IEnumerable<Vec3d>, IEnumerable
- Inheritance
-
Segment3d
- Implements
- Inherited Members
- Extension Methods
Constructors
Segment3d()
public Segment3d()
Segment3d(Vec3d, Vec3d)
public Segment3d(Vec3d begin, Vec3d end)
Parameters
Properties
Arrow
Gets the arrow vector from Begin to End.
public Vec3d Arrow { get; }
Property Value
Begin
public Vec3d Begin { get; set; }
Property Value
Center
Gets the midpoint of the segment.
public Vec3d Center { get; }
Property Value
End
public Vec3d End { get; set; }
Property Value
Length
Gets the length of the segment.
public double Length { get; }
Property Value
LengthSquare
public double LengthSquare { get; }
Property Value
Methods
ClosestPoint(Vec3d)
Gets the closest point on the segment to the specified point.
public Vec3d ClosestPoint(Vec3d point)
Parameters
point
Vec3dPoint to find closest point to.
Returns
- Vec3d
Closest point on the segment.
Equals(Segment3d)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Segment3d other)
Parameters
other
Segment3dAn 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
ExpandToBox3d(Box3d)
Expands the destination box. This function is usually used to compute the bounding box of elements.
public void ExpandToBox3d(Box3d dst)
Parameters
dst
Box3dDestination box
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<Vec3d> GetEnumerator()
Returns
- IEnumerator<Vec3d>
An enumerator that can be used to iterate through the collection.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
PointAt(double)
Gets a point on the segment at the specified parameter t (0 <= t <= 1).
public Vec3d PointAt(double t)
Parameters
t
doubleParameter value between 0 and 1.
Returns
- Vec3d
Point on the segment.
ReadBin(BinaryReader)
Reads binary data to initialize the object.
public void ReadBin(BinaryReader reader)
Parameters
reader
BinaryReaderThe binary reader to read from
Swap()
public void Swap()
ToString()
Returns a string representation of the segment.
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