use of maspack.geometry.BVIntersector in project artisynth_core by artisynth.
the class IntersectionFactory method buildIntersectionChart.
public static boolean[][] buildIntersectionChart(PolygonalMesh[] meshList, double tol) {
int n = meshList.length;
boolean[][] out = new boolean[n][n];
ArrayList<TriTriIntersection> intersections = new ArrayList<TriTriIntersection>();
// TriangleIntersector ti = new TriangleIntersector();
BVFeatureQuery query = new BVFeatureQuery();
BVIntersector intersector = new BVIntersector();
for (int i = 0; i < n; i++) {
PolygonalMesh mesh1 = meshList[i];
out[i][i] = true;
for (int j = i + 1; j < n; j++) {
PolygonalMesh mesh2 = meshList[j];
boolean intersects = false;
// }
if (intersector.intersectMeshMesh(intersections, mesh1, mesh2)) {
intersects = true;
intersections.clear();
} else if (query.isInsideOrientedMesh(mesh1, mesh2.getVertex(0).getPosition(), tol) || query.isInsideOrientedMesh(mesh2, mesh1.getVertex(0).getPosition(), tol)) {
intersects = true;
}
out[i][j] = intersects;
out[j][i] = intersects;
}
}
return out;
}
use of maspack.geometry.BVIntersector in project artisynth_core by artisynth.
the class FemDisplayProbe method updateIntersections.
/**
* computes intersection with mesh and plane
*/
protected void updateIntersections() {
if (myFem != null) {
getPlane(myPlane);
BVIntersector intersector = new BVIntersector();
myIntersections = intersector.intersectMeshPlane(myFem.getSurfaceMesh(), myPlane, myIntersectionTolerance);
}
}
use of maspack.geometry.BVIntersector in project artisynth_core by artisynth.
the class MeshIntersectingProbe method updateIntersections.
/**
* Computes intersection of the mesh with a plane
*/
protected void updateIntersections() {
if (myIntersectingMesh != null) {
getPlane(myPlane);
BVIntersector intersector = new BVIntersector();
myIntersections = intersector.intersectMeshPlane(myIntersectingMesh, myPlane, myIntersectionTolerance);
}
}
use of maspack.geometry.BVIntersector in project artisynth_core by artisynth.
the class MeshCollider method getContacts.
public ContactInfo getContacts(PolygonalMesh mesh0, PolygonalMesh mesh1) {
// long t0 = System.nanoTime();
// collisionMetrics.totalTime -= time;
// collisionMetrics.cullTime -= time;
// if (iFirst++ == 0) collisionMetrics.elapsedRealTime = -time;
mesh0.updateFaceNormals();
mesh1.updateFaceNormals();
BVIntersector intersector = new BVIntersector();
ContactInfo info = new ContactInfo(mesh0, mesh1);
// boolean didInt =
// mesh0.getObbtree().intersectFully (
// mesh1.getObbtree(), info.intersections, intersector);
info.myIntersections = new ArrayList<TriTriIntersection>();
boolean didInt = intersector.intersectMeshMesh(info.myIntersections, mesh0, mesh1);
// collisionMetrics.cullTime += time;
if (!didInt) {
// collisionMetrics.report(info);
return null;
}
return info;
}
Aggregations