maspack.geometry
Class BVIntersector

java.lang.Object
  extended by maspack.geometry.BVIntersector

public class BVIntersector
extends java.lang.Object

Worker class for computing intersections using bounding volume hierarchies.


Constructor Summary
BVIntersector()
           
 
Method Summary
 boolean intersectMeshLine(java.util.ArrayList<TriLineIntersection> intersections, BVTree bvh, Line line)
          Intersects the faces of a triangular mesh with a line.
 boolean intersectMeshLine(java.util.ArrayList<TriLineIntersection> intersections, PolygonalMesh mesh, Line line)
          Intersects the faces of a triangular mesh with a line.
 boolean intersectMeshMesh(java.util.ArrayList<TriTriIntersection> intersections, BVTree bvh1, BVTree bvh2)
          Intersects the faces of two triangular meshes, whose faces are contained within supplied bounding volume hierarchies.
 boolean intersectMeshMesh(java.util.ArrayList<TriTriIntersection> intersections, PolygonalMesh mesh1, PolygonalMesh mesh2)
          Intersects the faces of two triangular meshes.
 boolean intersectMeshPlane(java.util.ArrayList<TriPlaneIntersection> intersections, BVTree bvh, Plane plane)
          Intersects the faces of a triangular mesh with a plane.
 boolean intersectMeshPlane(java.util.ArrayList<TriPlaneIntersection> intersections, PolygonalMesh mesh, Plane plane)
          Intersects the faces of a triangular mesh with a plane.
 java.util.ArrayList<java.util.LinkedList<Point3d>> intersectMeshPlane(PolygonalMesh mesh, Plane plane, double tol)
          Intersects a PolygonalMesh with a plane, returning the set of intersection contours.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BVIntersector

public BVIntersector()
Method Detail

intersectMeshMesh

public boolean intersectMeshMesh(java.util.ArrayList<TriTriIntersection> intersections,
                                 PolygonalMesh mesh1,
                                 PolygonalMesh mesh2)
Intersects the faces of two triangular meshes. The process is accelerated using the default bounding volume hierarchy of each mesh. The results are returned in the array intersections, which contains information on each detected pair of intersecting triangles.

This method detects only face (triangle) intersections; it does not detect if one mesh is completely inside the other.

Parameters:
intersections - returns information for each pair of intersecting triangles.
mesh1 - first mesh to be intersected
mesh2 - second mesh to be intersected
Returns:
true if intersecting faces are detected

intersectMeshMesh

public boolean intersectMeshMesh(java.util.ArrayList<TriTriIntersection> intersections,
                                 BVTree bvh1,
                                 BVTree bvh2)
Intersects the faces of two triangular meshes, whose faces are contained within supplied bounding volume hierarchies. The results are returned in the array intersections, which contains information on each detected pair of intersecting triangles.

This method detects only face (triangle) intersections; it does not detect if one mesh is completely inside the other.

Parameters:
intersections - returns information for each pair of intersecting triangles.
bvh1 - bounding volume hierarchy for the first mesh to be intersected
bvh2 - bounding volume hierarchy for the second mesh to be intersected
Returns:
true if intersecting faces are detected

intersectMeshPlane

public boolean intersectMeshPlane(java.util.ArrayList<TriPlaneIntersection> intersections,
                                  PolygonalMesh mesh,
                                  Plane plane)
Intersects the faces of a triangular mesh with a plane. The process is accelerated using the default bounding volume hierarchy of the mesh. The results are returned in the array intersections, which contains information on each detected face-plane intersection.

Parameters:
intersections - returns information for each face-plane intersection.
mesh - the mesh to be intersected
plane - the plane to be intersected
Returns:
true if the mesh and the plane intersect

intersectMeshPlane

public boolean intersectMeshPlane(java.util.ArrayList<TriPlaneIntersection> intersections,
                                  BVTree bvh,
                                  Plane plane)
Intersects the faces of a triangular mesh with a plane. The faces of the mesh are contained within a supplied bounding volume hierarchy. The results are returned in the array intersections, which contains information on each detected face-plane intersection.

Parameters:
intersections - returns information for each face-plane intersection.
bvh - bounding volume hierarchy containing the mesh faces
plane - the plane to be intersected
Returns:
true if the mesh and the plane intersect

intersectMeshLine

public boolean intersectMeshLine(java.util.ArrayList<TriLineIntersection> intersections,
                                 PolygonalMesh mesh,
                                 Line line)
Intersects the faces of a triangular mesh with a line. The process is accelerated using the default bounding volume hierarchy of the mesh. The results are returned in the array intersections, which contains information on each detected face-line intersection.

Parameters:
intersections - returns information for each line-plane intersection.
mesh - the mesh to be intersected
line - the line to be intersected
Returns:
true if the mesh and the line intersect

intersectMeshLine

public boolean intersectMeshLine(java.util.ArrayList<TriLineIntersection> intersections,
                                 BVTree bvh,
                                 Line line)
Intersects the faces of a triangular mesh with a line. The faces of the mesh are contained within a supplied bounding volume hierarchy. The results are returned in the array intersections, which contains information on each detected face-line intersection.

Parameters:
intersections - returns information for each face-line intersection.
bvh - bounding volume hierarchy containing the mesh faces
line - the line to be intersected
Returns:
true if the mesh and the line intersect

intersectMeshPlane

public java.util.ArrayList<java.util.LinkedList<Point3d>> intersectMeshPlane(PolygonalMesh mesh,
                                                                             Plane plane,
                                                                             double tol)
Intersects a PolygonalMesh with a plane, returning the set of intersection contours.

Parameters:
mesh - mesh to intersect
plane - plane to intersect with
tol - tolerance within which points are considered identical
Returns:
an array of contours, each described by a linked-list of points. For closed curves, the first and last point in the linked-list are the same object