Search in sources :

Example 6 with AABBTree

use of maspack.geometry.AABBTree in project artisynth_core by artisynth.

the class MFreeModel3d method findDependentNodesAtRest.

/**
 * Finds nodes containing the given point at rest
 * @param pnt point to find nodes for
 * @param out output list of nodes influencing region
 * @return number of nodes found
 */
public int findDependentNodesAtRest(Point3d pnt, List<FemNode3d> out) {
    AABBTree nodeTree = myRestNodeTree;
    if (nodeTree == null) {
        nodeTree = buildRestNodeTree(myNodes);
        myRestNodeTree = nodeTree;
    }
    ArrayList<BVNode> bvNodes = new ArrayList<BVNode>(16);
    nodeTree.intersectPoint(bvNodes, pnt);
    if (bvNodes.size() == 0) {
        return 0;
    }
    int count = 0;
    for (BVNode n : bvNodes) {
        Boundable[] elements = n.getElements();
        for (int i = 0; i < elements.length; i++) {
            RestNode rnode = (RestNode) elements[i];
            FemNode3d node = rnode.getNode();
            if (((MFreeNode3d) node).isInDomain(pnt, 0)) {
                out.add(node);
                ++count;
            }
        }
    }
    return count;
}
Also used : AABBTree(maspack.geometry.AABBTree) BVNode(maspack.geometry.BVNode) ArrayList(java.util.ArrayList) FemNode3d(artisynth.core.femmodels.FemNode3d) Boundable(maspack.geometry.Boundable) Point(artisynth.core.mechmodels.Point)

Aggregations

AABBTree (maspack.geometry.AABBTree)6 Point (artisynth.core.mechmodels.Point)4 Boundable (maspack.geometry.Boundable)4 FemNode3d (artisynth.core.femmodels.FemNode3d)2 ArrayList (java.util.ArrayList)2 BVNode (maspack.geometry.BVNode)2 HashMap (java.util.HashMap)1 PolygonalMesh (maspack.geometry.PolygonalMesh)1 TriangleIntersector (maspack.geometry.TriangleIntersector)1 DirectedGraph (maspack.graph.DirectedGraph)1 Point3d (maspack.matrix.Point3d)1 Vector3d (maspack.matrix.Vector3d)1 VectorNd (maspack.matrix.VectorNd)1 FunctionTimer (maspack.util.FunctionTimer)1