Namespaces

Types in MathNet.Spatial.Euclidean

Type LineSegment3D

Namespace MathNet.Spatial.Euclidean

Parent ValueType

Interfaces IEquatable<LineSegment3D>, IXmlSerializable

This structure represents a line between two points in 3D-space. It allows for operations such as computing the length, direction, comparisons, and shifting by a vector.

Constructors

Static Functions

Methods

Properties

Public Constructors

LineSegment3D(Point3D startPoint, Point3D endPoint)

Initializes a new instance of the LineSegment3D struct. Throws an ArgumentException if the startPoint is equal to the endPoint.
Parameters
Point3D startPoint

the starting point of the line segment.

Point3D endPoint

the ending point of the line segment

Public Static Functions

LineSegment3D Parse(string startPointString, string endPointString)

Returns a new Line2D from a pair of strings which represent points. See Parse for details on acceptable formats.
Parameters
string startPointString

The string representation of the first point.

string endPointString

The string representation of the second point.

Return
LineSegment3D

A line segment from the first point to the second point.

Public Methods

Point3D ClosestPointTo(Point3D p)

Returns the closest point on the line segment to the given point.
Parameters
Point3D p

The point that the returned point is the closest point on the line to

Return
Point3D

The closest point on the line to the provided point

bool Equals(LineSegment3D other, double tolerance)

Returns a value to indicate if a pair of line segments are equal
Parameters
LineSegment3D other

The line segment to compare against.

double tolerance

A tolerance (epsilon) to adjust for floating point error

Return
bool

True if the line segments are equal; otherwise false

bool Equals(LineSegment3D l)

bool Equals(object obj)

int GetHashCode()

Type GetType()

bool IsParallelTo(LineSegment3D other, Angle tolerance)

Checks to determine whether or not two line segments are parallel to each other within a specified angle tolerance
Parameters
LineSegment3D other

The other line to check this one against

Angle tolerance

If the angle between line directions is less than this value, the method returns true

Return
bool

True if the lines are parallel within the angle tolerance, false if they are not

LineSegment3D LineTo(Point3D p)

Returns a new line segment between the closest point on this line segment and a point.
Parameters
Point3D p

the point to create a line to

Return
LineSegment3D

A line segment between the nearest point on this segment and the provided point.

string ToString()

LineSegment3D TranslateBy(Vector3D vector)

Translates a line according to a provided vector
Parameters
Vector3D vector

A vector to apply

Return
LineSegment3D

A new translated line segment

bool TryShortestLineTo(LineSegment3D other, Angle tolerance, LineSegment3D& closestLine)

Public Properties

UnitVector3D Direction get;

Gets a normalized vector in the direction from StartPoint to EndPoint

Point3D EndPoint get; set;

The end point of the line segment

double Length get;

Gets the distance from StartPoint to EndPoint

Point3D StartPoint get; set;

The starting point of the line segment