intersectRay3d Method

Compute the intersection of a line (parameterized as a ray) with the plane of this triangle.

  • Intersection data is returned for the line-plane intersection.
  • No intersection is returned if the line is parallel to the plane.
  • As for the ray, it intersects this triangle if and only if the returned detail d has d.isValid === true and d.a >= 0 and d.isInsideOrOn === true.
  • This method is slower than Ray3d.intersectionWithTriangle but returns more information about the intersection.

intersectRay3d(ray: Ray3d, result?: TriangleLocationDetail): TriangleLocationDetail

@returns details d of the intersection point p of the line and the plane of this triangle:

  • d.isValid: false if and only if ray.direction is parallel to the plane, or the ray or triangle is degenerate.
  • d.world: coordinates of p.
  • d.local: barycentric coordinates of p.
  • d.a: the intersection parameter of p along the ray. Negative means p is behind the ray origin.
  • d.classify: where p lies with respect to the triangle.
  • d.isInsideOrOn: whether p is inside or on the triangle.
  • d.closestEdgeIndex: the index of the triangle edge e onto which p projects.
  • d.closestEdgeParam: the edge parameter at which p projects onto e.
  • Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/RayTriangleIntersection

@see pointToFraction

Parameter Type Description
ray Ray3d infinite line to intersect, as a ray
result TriangleLocationDetail optional pre-allocated object to fill and return

Returns - TriangleLocationDetail

details d of the intersection point p of the line and the plane of this triangle:

  • d.isValid: false if and only if ray.direction is parallel to the plane, or the ray or triangle is degenerate.
  • d.world: coordinates of p.
  • d.local: barycentric coordinates of p.
  • d.a: the intersection parameter of p along the ray. Negative means p is behind the ray origin.
  • d.classify: where p lies with respect to the triangle.
  • d.isInsideOrOn: whether p is inside or on the triangle.
  • d.closestEdgeIndex: the index of the triangle edge e onto which p projects.
  • d.closestEdgeParam: the edge parameter at which p projects onto e.
  • Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/RayTriangleIntersection

Defined in

Last Updated: 18 January, 2025