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
hasd.isValid === true
andd.a >= 0
andd.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 ifray.direction
is parallel to the plane, or the ray or triangle is degenerate.d.world
: coordinates ofp
.d.local
: barycentric coordinates ofp
.d.a
: the intersection parameter ofp
along the ray. Negative meansp
is behind the ray origin.d.classify
: wherep
lies with respect to the triangle.d.isInsideOrOn
: whetherp
is inside or on the triangle.d.closestEdgeIndex
: the index of the triangle edgee
onto whichp
projects.d.closestEdgeParam
: the edge parameter at whichp
projects ontoe
.- 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 ifray.direction
is parallel to the plane, or the ray or triangle is degenerate.d.world
: coordinates ofp
.d.local
: barycentric coordinates ofp
.d.a
: the intersection parameter ofp
along the ray. Negative meansp
is behind the ray origin.d.classify
: wherep
lies with respect to the triangle.d.isInsideOrOn
: whetherp
is inside or on the triangle.d.closestEdgeIndex
: the index of the triangle edgee
onto whichp
projects.d.closestEdgeParam
: the edge parameter at whichp
projects ontoe
.- Visualization can be found at https://www.itwinjs.org/sandbox/SaeedTorabi/RayTriangleIntersection
Defined in
- geometry3d/BarycentricTriangle.ts Line 528
Last Updated: 18 January, 2025
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.