Skip to content

Line

Public Struct

Represents the value of start and end points in a single line segment.

Namespace: Rhino.Geometry

Assembly: RhinoCommon (in RhinoCommon.dll)

Syntax

[SerializableAttribute]
public struct Line : IEquatable<Line>,
IEpsilonComparable<Line>, ICloneable, IFormattable

The Line type exposes the following members.

Constructors

Name

Description


Public Method

Constructs a new line segment between two points.


Public Method

Constructs a new line segment from start point and span vector.


Public Method

Constructs a new line segment from start point, direction and length.


Public Method

Constructs a new line segment between two points.


Properties

Name

Description


Public Property

Gets the line’s 3d axis aligned bounding box.


Public Property
Code Example

Gets the direction of this line segment. The length of the direction vector equals the length of the line segment.


Public Property

Start point of line segment.


Public Property

Gets or sets the X coordinate of the line From point.


Public Property

Gets or sets the Y coordinate of the line From point.


Public Property

Gets or sets the Z coordinate of the line From point.


Public Property

Gets a value indicating whether or not this line is valid. Valid lines must have valid start and end points, and the points must not be equal.


Public Property

Gets or sets the length of this line segment. Note that a negative length will invert the line segment without making the actual length negative. The line From point will remain fixed when a new Length is set.


Public Property

End point of line segment.


Public Property

Gets or sets the X coordinate of the line To point.


Public Property

Gets or sets the Y coordinate of the line To point.


Public Property

Gets or sets the Z coordinate of the line To point.


Public Property

Gets the tangent of the line segment. Note that tangent vectors are always unit vectors.


Public Property
Static Member

Gets a line segment which has

end points.


Methods

Name

Description


Public Method

Finds the parameter on the infinite line segment that is closest to a test point.


Public Method

Finds the point on the (in)finite line segment that is closest to a test point.


Public Method

Compute the shortest distance between this line segment and a test point.


Public Method

Check that all values in other are within epsilon of the values in this


Public Method

Determines whether a line has the same value as this line.


Public Method

Determines whether an object is a line that has the same value as this line.

(Overrides ValueType.Equals(Object).)


Public Method

Extend the line by custom distances on both sides.


Public Method

Ensure the line extends all the way through a box. Note, this does not result in the shortest possible line that overlaps the box.


Public Method

Ensure the line extends all the way through a box. Note, this does not result in the shortest possible line that overlaps the box.


Public Method

Ensure the line extends all the way through a box. Note, this does not result in the shortest possible line that overlaps the box.


Public Method

Ensure the line extends all the way through a box. Note, this does not result in the shortest possible line that overlaps the box.


Public Method

Flip the endpoints of the line segment.


Public Method

Computes a hash number that represents this line.

(Overrides ValueType.GetHashCode..)


Public Method

GetType

Gets the Type of the current instance.

(Inherited from Object.)


Public Method

Finds the largest distance between this line as a finite segment and another finite segment.


Public Method

Finds the largest distance between this line as a finite segment and a test point.


Public Method

Finds the shortest distance between this line as a finite segment and another finite segment.


Public Method

Finds the shortest distance between this line as a finite segment and a test point.


Public Method
Code Example

Evaluates the line at the specified parameter.


Public Method

Computes a point located at a specific metric distance from the line origin (

).

If line start and end coincide, then the start point is always returned.


Public Method

Constructs a nurbs curve representation of this line. This amounts to the same as calling NurbsCurve.CreateFromLine().


Public Method

Constructs the string representation of this line, in the form “From,To”.

(Overrides ValueType.ToString..)


Public Method

Formats the value of the current instance using the specified format.


Public Method

Transform the line using a Transformation matrix.


Public Method
Static Member

Creates a line segment between a pair of curves such that the line segment is either tangent or perpendicular to each of the curves.


Public Method
Static Member

Attempt to fit a line through a set of points.


Public Method

Gets a plane that contains the line. The origin of the plane is at the start of the line. If possible, a plane parallel to the world XY, YZ, or ZX plane is returned.


Operators

Name

Description


Public Operator
Static Member
Equality

Determines whether two lines have the same value.


Public Operator
Static Member
Inequality

Determines whether two lines have different values.