intersectRay3d MethodStatic

Search facets for the first one that intersects the infinite line.

  • To process all intersections, callers can supply an options.acceptIntersection callback that always returns false. In this case, intersectRay3d will return undefined, but the callback will be invoked for each intersection.
  • Example callback logic:
    • Accept the first found facet that intersects the half-line specified by the ray: return detail.a >= 0.0;
    • Collect all intersections: myIntersections.push(detail.clone()); return false; Then after intersectRay3d returns, sort along ray with myIntersections.sort((d0, d1) => d0.a - d1.a);

intersectRay3d(visitor: Polyface | PolyfaceVisitor, ray: Ray3d, options?: FacetIntersectOptions): undefined | FacetLocationDetail

@returns detail for the (accepted) intersection with detail.IsInsideOrOn === true, or undefined if no (accepted) intersection

@see PolygonOps.intersectRay3d

Parameter Type Description
visitor Polyface | PolyfaceVisitor facet iterator
ray Ray3d infinite line parameterized as a ray. The returned detail.a is the intersection parameter on the ray, e.g., zero at ray.origin and increasing in ray.direction.
options FacetIntersectOptions options for computing and populating an intersection detail, and an optional callback for accepting one

Returns - undefined | FacetLocationDetail

detail for the (accepted) intersection with detail.IsInsideOrOn === true, or undefined if no (accepted) intersection

Defined in

Last Updated: 25 April, 2024