Class: Line

x3dom.fields. Line

Represents a Line (as internal helper). A line has an origin and a vector that describes a direction, it is infinite in both directions.

Inheritance

  • Line

Constructor

Line(pos, dir)

Line constructor.

Parameters:
Name Type Description
pos SFVec3f anchor point of the line
dir SFVec3f direction of the line, must be normalized


Methods

closestPoint(p) → {x3dom.fields.SFVec3f}

For a given point, this function returns the closest point on this line.

Parameters:
Name Type Description
p {x3dom.fields.SFVec3f} - the point

Returns:
the closest point

shortestDistance(p) → {Number}

For a given point, this function returns the distance to the closest point on this line.

Parameters:
Name Type Description
p {x3dom.fields.SFVec3f} - the point

Returns:
the distance to the closest point