Class: Ray

x3dom.fields. Ray

Represents a Ray (as internal helper). A ray is a special line that extends to only one direction from its origin.


  • Ray


Ray(pos, dir)

Ray constructor.

Name Type Description
pos SFVec3f anchor point of the ray
dir SFVec3f direction of the ray, must be normalized


intersect(low, high)

Intersect line with box volume given by low and high

Name Type Description
low number
high number

intersectPlane(p, n) → {x3dom.fields.SFVec3f}

Intersects this ray with a plane, defined by the given anchor point and normal. The result returned is the point of intersection, if any. If no point of intersection exists, null is returned. Null is also returned in case there is an infinite number of solutions (, i.e., if the ray origin lies in the plane).

Name Type Description
p x3dom.fields.SFVec3f anchor point
n x3dom.fields.SFVec3f plane normal

the point of intersection, can be null