public class TriangleIntersector
extends java.lang.Object
| Constructor and Description |
|---|
TriangleIntersector() |
| Modifier and Type | Method and Description |
|---|---|
double |
getEpsilon() |
int |
intersect(Point3d v0,
Point3d v1,
Point3d v2,
Point3d pos,
Vector3d dir,
Vector3d duv)
Determines the bary centric coordinates of a ray hitting a triangle.
|
java.util.ArrayList<Point3d> |
intersectTrianglePlane(Point3d p0,
Point3d p1,
Point3d p2,
Plane plane) |
Point3d[] |
intersectTriangleTriangle(Vector3d p1,
Vector3d q1,
Vector3d r1,
Vector3d p2,
Vector3d q2,
Vector3d r2) |
double |
nearestpoint(Point3d v0,
Point3d v1,
Point3d v2,
Point3d p,
Point3d closest,
Vector2d uv)
Finds the nearest distance between a point and a triangle.
|
void |
setEpsilon(double e) |
public void setEpsilon(double e)
public double getEpsilon()
public Point3d[] intersectTriangleTriangle(Vector3d p1, Vector3d q1, Vector3d r1, Vector3d p2, Vector3d q2, Vector3d r2)
public int intersect(Point3d v0, Point3d v1, Point3d v2, Point3d pos, Vector3d dir, Vector3d duv)
v0 - The first vertex.v1 - The second vertex.v2 - The third vertex.pos - The ray's origin.dir - The ray's direction.duv - The resulting coordinates of the projection in the space of the ray and
vector with t being the distance along the vector and u/v being
barycentric coordinates.public double nearestpoint(Point3d v0, Point3d v1, Point3d v2, Point3d p, Point3d closest, Vector2d uv)
v0 - The first vertice.v1 - The second vertice.v2 - The third vertice.p - The point to measure from.closest - (optional)
Returns the closest point to p on the triangle.uv - (optional)
Returns the barycentric coordinates of the nearest
point where u and v are the weights for vertices 1 and 2 respectively.