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;
}
Aggregations