GCubeSDK
©2026 FenixFox®Studios

Line3

Class representing an analytical line segment in 3D space. A line segment is represented by a start and end point. It is used for various geometric calculations and intersection tests.

Methods

Line3(const Vector3& start, const Vector3& end)

Constructor to create new line segment

start start of the line segment Vector3(0,0,0)
end end of the line segment Vector3(0,0,0)

Line3& set(const Vector3& start, const Vector3& end)

Sets the start and end values by copying the given vectors

start start point
end end point

Line3 clone() const

Returns a new line segment with copied values from this instance

Line3& copy(const Line3& line)

Copies the values of the given line segment to this instance

line line segment to copy from

Vector3& at(f32 t, Vector3& target) const

Returns a vector at a certain position along the line segment

t value between [0,1] to represent a position along the line segment
target target vector that is used to store the method's result

Vector3& delta(Vector3& target) const

Returns the delta vector of the line segment's start and end point

target target vector that is used to store the method's result

Vector3& getCenter(Vector3& target) const

Returns the center of the line segment

target target vector that is used to store the method's result

Vector3& closestPointToPoint(const Vector3& point, bool clampToLine, Vector3& target) const

Returns the closest point on the line for a given point

point point to compute the closest point on the line for
clampToLine whether to clamp the result to the range [0,1] or not
target target vector that is used to store the method's result

f32 closestPointToPointParameter(const Vector3& point, bool clampToLine) const

Returns a point parameter based on the closest point as projected on the line segment

point point for which to return a point parameter
clampToLine whether to clamp the result to the range [0,1] or not

f32 distance() const

Returns the Euclidean distance between the line's start and end point

f32 distanceSq() const

Returns the squared Euclidean distance between the line's start and end point

f32 distanceSqToLine3(const Line3& line, Vector3& c1, Vector3& c2) const

Returns the closest squared distance between this line segment and the given one

line line segment to compute the closest squared distance to
c1 closest point on this line segment
c2 closest point on the given line segment

Line3& applyMatrix4(const Matrix4& matrix)

Applies a 4x4 transformation matrix to this line segment

matrix transformation matrix

bool equals(const Line3& line) const

Returns true if this line segment is equal with the given one

line line segment to compare with this one

bool operator==(const Line3& line) const

Checks if this line segment equals another

line line segment to compare with

bool operator!=(const Line3& line) const

Checks if this line segment does not equal another

line line segment to compare with

Properties

enabled bool Active/inactive
end Vector3 end of the line segment
id u32 Unique identifier
isLine3 bool Read-only tag
name string Optional display name
start Vector3 start of the line segment
uuid string UUID string
version u32 Bumps on change