Class Line
- Namespace
- SearchAThing.OpenGL.Core
- Assembly
- netcore-opengl-core.dll
Geometric entity 3d line.
Internally encoded as From and V vectors, where To = From + V.
Can be created through static methods FromTo(in Vector3, in Vector3) and PointV(in Vector3, in Vector3).
public class Line
- Inheritance
-
Line
- Inherited Members
- Extension Methods
Properties
From
Coordinate "from" of the line.
public Vector3 From { get; }
Property Value
Length
Length of the line segment.
public float Length { get; }
Property Value
MidPoint
Line midpoint as (From + To) / 2.
public Vector3 MidPoint { get; }
Property Value
To
Coordinate "to" of the line.
public Vector3 To { get; }
Property Value
V
Vector extension of the line so that To = From + V.
public Vector3 V { get; }
Property Value
Methods
Contains(float, in Vector3, out Vector3, bool)
States if this line contains given point within given tolerance.
public float? Contains(float tol, in Vector3 p, out Vector3 prj, bool segmentMode = false)
Parameters
tol
floatComparision tolerance.
p
Vector3Point to test if its contained in this line.
prj
Vector3Point projected onto this line.
segmentMode
boolIf true line will treated as a segment ( Default: false ).
Returns
- float?
Distance to projected point if contained under given tolerance, null otherwise.
FromTo(in Vector3, in Vector3)
Create a line by two given points.
public static Line FromTo(in Vector3 from, in Vector3 to)
Parameters
Returns
Intersect(in Matrix4x4)
Test if this line intersect given plane and retrieve intersection point or null if no intersect.
public Vector3? Intersect(in Matrix4x4 plane)
Parameters
plane
Matrix4x4Plane to test line intersection with. ( MakeCS(in Vector3, in Vector3) to create planes )
Returns
- Vector3?
Intersection point or null if no intersection found.
Remarks
Intersect(float, in Line, out float, bool, bool)
Intresect this line to the given other.
public Vector3? Intersect(float tol, in Line other, out float dst, bool thisAsSegment = false, bool otherAsSegment = false)
Parameters
tol
floatLength tolerance comparision.
other
LineOther line.
dst
floatDistance between two intersecting lines.
thisAsSegment
boolTreat this line as a segment from,to.
otherAsSegment
boolTreat other line as a segment from,to.
Returns
- Vector3?
Intersection point or null if line parallel or no intersects.
PointV(in Vector3, in Vector3)
Create a line by the from position and given extension.
public static Line PointV(in Vector3 point, in Vector3 v)
Parameters
Returns
Scale(in Vector3, float)
Create a new line by scaling from, to coordinates respect the given reference point and scale factor.
public Line Scale(in Vector3 refpt, float factor)
Parameters
Returns
- Line
Scaled line.
ToString()
public override string ToString()