public class MollerTrumbore extends Object
This algorithm can efficiently tells whether a ray intersects with a triangle in a mesh. Adapted from Wikipedia.
| Constructor and Description |
|---|
MollerTrumbore(Mesh mesh) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
rayIntersectsTriangle(long id,
double ox,
double oy,
double oz,
double rx,
double ry,
double rz,
double[] intersection)
Returns true if the specified ray intersects with the specified triangle
in the mesh, and if yes, store the position of intersection in an array.
|
public MollerTrumbore(Mesh mesh)
public boolean rayIntersectsTriangle(long id,
double ox,
double oy,
double oz,
double rx,
double ry,
double rz,
double[] intersection)
id - the triangle to test.ox - the X position of the ray origin.oy - the Y position of the ray origin.oz - the Z position of the ray origin.rx - the X coordinate of the ray vector.ry - the Y coordinate of the ray vector.rz - the Z coordinate of the ray vector.intersection - a double[] array of at least 3 elements to store
the intersection position. Is not modified if the ray does not
intersect the triangle.true if the ray intersects the triangle.Copyright © 2016–2023 ImgLib2. All rights reserved.