Table of Contents

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

Vector3

Length

Length of the line segment.

public float Length { get; }

Property Value

float

MidPoint

Line midpoint as (From + To) / 2.

public Vector3 MidPoint { get; }

Property Value

Vector3

To

Coordinate "to" of the line.

public Vector3 To { get; }

Property Value

Vector3

V

Vector extension of the line so that To = From + V.

public Vector3 V { get; }

Property Value

Vector3

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 float

Comparision tolerance.

p Vector3

Point to test if its contained in this line.

prj Vector3

Point projected onto this line.

segmentMode bool

If 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

from Vector3

From point.

to Vector3

To point.

Returns

Line

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 Matrix4x4

Plane 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 float

Length tolerance comparision.

other Line

Other line.

dst float

Distance between two intersecting lines.

thisAsSegment bool

Treat this line as a segment from,to.

otherAsSegment bool

Treat 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

point Vector3

From coordinate.

v Vector3

Extension vector.

Returns

Line

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

refpt Vector3

Reference point.

factor float

Scale factor.

Returns

Line

Scaled line.

ToString()

public override string ToString()

Returns

string