intersectionWithTriangle Method

Compute the intersection of the ray with a triangle.

  • This method is faster than BarycentricTriangle.intersectRay3d.

intersectionWithTriangle(vertex0: Point3d, vertex1: Point3d, vertex2: Point3d, distanceTol?: number, parameterTol?: number, result?: Point3d): undefined | Point3d

@returns the intersection point if ray intersects the triangle. Otherwise, return undefined.

Parameter Type Description
vertex0 Point3d first vertex of the triangle
vertex1 Point3d second vertex of the triangle
vertex2 Point3d third vertex of the triangle
distanceTol number optional tolerance used to check if ray is parallel to the triangle or if we have line
intersection but not ray intersection (if tolerance is not provided, Geometry.smallMetricDistance is used)
parameterTol number optional tolerance used to snap barycentric coordinates of the intersection point to
a triangle edge or vertex (if tolerance is not provided, Geometry.smallFloatingPoint is used)
result Point3d optional pre-allocated object to fill and return

Returns - undefined | Point3d

the intersection point if ray intersects the triangle. Otherwise, return undefined.

Defined in

Last Updated: 02 May, 2024