maspack.geometry
Class TriangleIntersector
java.lang.Object
maspack.geometry.TriangleIntersector
public class TriangleIntersector
- extends java.lang.Object
Method Summary |
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)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
epsilon
public double epsilon
TriangleIntersector
public TriangleIntersector()
setEpsilon
public void setEpsilon(double e)
getEpsilon
public double getEpsilon()
intersectTriangleTriangle
public Point3d[] intersectTriangleTriangle(Vector3d p1,
Vector3d q1,
Vector3d r1,
Vector3d p2,
Vector3d q2,
Vector3d r2)
intersect
public 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.
- Parameters:
v0
- The first vertice.v1
- The second vertice.v2
- The third vertice.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.
nearestpoint
public double nearestpoint(Point3d v0,
Point3d v1,
Point3d v2,
Point3d p,
Point3d closest,
Vector2d uv)
- Finds the nearest distance between a point and a triangle.
- Parameters:
v0
- The first vertice.v1
- The second vertice.v2
- The third vertice.p
- The point to measure from.closest
- The closest point to p on the triangle.uv
- The barycentric coordinates of the nearest point where u and v are the
weights for vertices 1 and 2 respectively.
- Returns:
- The distance from point p to the nearest point on triangle v0, v1
and v2.
intersectTrianglePlane
public java.util.ArrayList<Point3d> intersectTrianglePlane(Point3d p0,
Point3d p1,
Point3d p2,
Plane plane)