struct Line

book_4_sparkGenerated
code_blocksInput

Description

The Line struct represents a line in 3D space. It provides methods to perform various geometric calculations such as finding the closest point on the line to a given point or ray, and calculating distances.

Members

Properties

Member NameSummary
StartStart position of the line.
EndEnd position of the line.
DeltaReturns the result of b - a.
CenterReturns the midpoint between a and b.

Methods

Member NameSummary
TraceTraces a ray against the line with a specified radius and maximum distance.
ClosestPoint(Vector3& pos)Finds the closest point on the line to a given position.
ClosestPoint(Ray& ray, Vector3& point_on_line)Finds the closest point on the line to a given ray.
ClosestPoint(Ray& ray, Vector3& point_on_line, Vector3& point_on_ray)Finds the closest points on both the line and the ray.
Distance(Vector3 pos)Calculates the distance from a point to the line.
Distance(Vector3 pos, Vector3& closestPoint)Calculates the distance from a point to the line and returns the closest point on the line.
SqrDistance(Vector3 pos)Calculates the squared distance from a point to the line.