Search in sources :

Example 1 with BVIntersector

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;
}
Also used : ArrayList(java.util.ArrayList) TriTriIntersection(maspack.geometry.TriTriIntersection) BVIntersector(maspack.geometry.BVIntersector) BVFeatureQuery(maspack.geometry.BVFeatureQuery) PolygonalMesh(maspack.geometry.PolygonalMesh)

Example 2 with BVIntersector

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);
    }
}
Also used : BVIntersector(maspack.geometry.BVIntersector)

Example 3 with BVIntersector

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);
    }
}
Also used : BVIntersector(maspack.geometry.BVIntersector)

Example 4 with BVIntersector

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;
}
Also used : TriTriIntersection(maspack.geometry.TriTriIntersection) BVIntersector(maspack.geometry.BVIntersector)

Aggregations

BVIntersector (maspack.geometry.BVIntersector)4 TriTriIntersection (maspack.geometry.TriTriIntersection)2 ArrayList (java.util.ArrayList)1 BVFeatureQuery (maspack.geometry.BVFeatureQuery)1 PolygonalMesh (maspack.geometry.PolygonalMesh)1