Line
References[StructLayout(LayoutKind.Sequential, Pack = 8, Size = 48)]
[Serializable]
public struct Line : IEquatable<Line>, IEpsilonComparable<Line>, ICloneable, IFormattable
Represents the value of start and end points in a single line segment.
Constructors
Constructs a new line segment between two points.
Constructs a new line segment between two points.
Constructs a new line segment from start point, direction and length.
Properties
Gets the line's 3d axis aligned bounding box.
Returns: 3d bounding box.
Gets the direction of this line segment. The length of the direction vector equals the length of the line segment.
Gets or sets the X coordinate of the line From point.
Gets or sets the Y coordinate of the line From point.
Gets or sets the Z coordinate of the line From point.
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.
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.
Gets the tangent of the line segment. Note that tangent vectors are always unit vectors.
Value: Sets only the direction of the line, the length is maintained.
Gets a line segment which has Point3d.Unset end points.
Methods
Finds the parameter on the infinite line segment that is closest to a test point.
Parameters:
| testPoint (Point3d) | Point to project onto the line. |
Returns: The parameter on the line that is closest to testPoint.
Finds the point on the (in)finite line segment that is closest to a test point.
Compute the shortest distance between this line segment and a test point.
Check that all values in other are within epsilon of the values in this
Implements: EpsilonEquals
Determines whether a line has the same value as this line.
Parameters:
| other (Line) | A line. |
Returns: true if other has the same coordinates as this; otherwise false.
Equals
#Determines whether an object is a line that has the same value as this line.
Parameters:
| obj (object) | An object. |
Returns: true if obj is a Line and has the same coordinates as this; otherwise false.
Overrides: ValueType.Equals
Extend the line by custom distances on both sides.
Ensure the line extends all the way through a box. Note, this does not result in the shortest possible line that overlaps the box.
Parameters:
| box (BoundingBox) | Box to extend through. |
| additionalLength (double) | Additional length to append at both sides of the line. |
Returns: true on success, false on failure.
Ensure the line extends all the way through a box. Note, this does not result in the shortest possible line that overlaps the box.
Parameters:
| box (BoundingBox) | Box to extend through. |
Returns: true on success, false on failure.
Ensure the line extends all the way through a box. Note, this does not result in the shortest possible line that overlaps the box.
Ensure the line extends all the way through a box. Note, this does not result in the shortest possible line that overlaps the box.
Parameters:
| box (Box) | Box to extend through. |
Returns: true on success, false on failure.
GetHashCode
#Computes a hash number that represents this line.
Returns: A number that is not unique to the value of this line.
Overrides: ValueType.GetHashCode
Finds the largest distance between this line as a finite segment and another finite segment.
Parameters:
| testLine (Line) | A line to test. |
Returns: The maximum distance.
Finds the largest distance between this line as a finite segment and a test point.
Parameters:
| testPoint (Point3d) | A point to test. |
Returns: The maximum distance.
Finds the shortest distance between this line as a finite segment and another finite segment.
Parameters:
| testLine (Line) | A line to test. |
Returns: The minimum distance.
Finds the shortest distance between this line as a finite segment and a test point.
Parameters:
| testPoint (Point3d) | A point to test. |
Returns: The minimum distance.
Evaluates the line at the specified parameter.
Parameters:
| t (double) | Parameter to evaluate line segment at. Line parameters are normalized parameters. |
Returns: The point at the specified parameter.
Computes a point located at a specific metric distance from the line origin (From).
If line start and end coincide, then the start point is always returned.
Constructs a nurbs curve representation of this line. This amounts to the same as calling NurbsCurve.CreateFromLine().
Returns: A nurbs curve representation of this line or null if no such representation could be made.
ToString
#Constructs the string representation of this line, in the form "From,To".
Returns: A text string.
Overrides: ValueType.ToString
Formats the value of the current instance using the specified format.
Parameters:
| format (string) | The format to use. -or- A null reference (Nothing in Visual Basic) to use the default format defined for the type of the IFormattable implementation. |
| formatProvider (IFormatProvider) | The provider to use to format the value. -or- A null reference (Nothing in Visual Basic) to obtain the numeric format information from the current locale setting of the operating system. |
Returns: The value of the current instance in the specified format.
Transform the line using a Transformation matrix.
Parameters:
| xform (Transform) | Transform to apply to this line. |
Returns: true on success, false on failure.
public static bool TryCreateBetweenCurves(Curve curve0, Curve curve1, ref double t0, ref double t1, bool perpendicular0, bool perpendicular1, out Line line)
Creates a line segment between a pair of curves such that the line segment is either tangent or perpendicular to each of the curves.
Parameters:
| curve0 (Curve) | The first curve. |
| curve1 (Curve) | The second curve. |
| t0 (ref double) | Parameter value of point on curve0. Seed value at input and solution at output. |
| t1 (ref double) | Parameter value of point on curve 0. Seed value at input and solution at output. |
| perpendicular0 (bool) | Find line perpendicular to (true) or tangent to (false) curve0. |
| perpendicular1 (bool) | Find line Perpendicular to (true) or tangent to (false) curve1. |
| line (out Line) | The line segment if successful. |
Returns: true on success, false on failure.
Attempt to fit a line through a set of points.
Parameters:
| points (IEnumerable<Point3d>) | The points through which to fit. |
| fitLine (out Line) | The resulting line on success. |
Returns: true on success, false on failure.
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.
Parameters:
| plane (out Plane) | If the return value is true, the plane out parameter is assigned during this call. |
Returns: true on success.