@Override boolean intersect(Point3d[] pnts) { Transform3D tempT3D = new Transform3D(); GeometryArrayRetained ga; boolean isIntersect = false; Point3d transPnts[] = new Point3d[pnts.length]; for (int j = pnts.length - 1; j >= 0; j--) { transPnts[j] = new Point3d(); } for (int i = numChars - 1; i >= 0; i--) { ga = geometryList[i]; if (ga != null) { tempT3D.invert(charTransforms[i]); for (int j = pnts.length - 1; j >= 0; j--) { tempT3D.transform(pnts[j], transPnts[j]); } if (ga.intersect(transPnts)) { isIntersect = true; break; } } } return isIntersect; }
@Override boolean intersect(Bounds targetBound) { GeometryArrayRetained ga; for (int i = numChars - 1; i >= 0; i--) { ga = geometryList[i]; if ((ga != null) && ga.intersect(targetBound)) { return true; } } return false; }
@Override boolean intersect(Transform3D thisToOtherVworld, GeometryRetained geom) { GeometryArrayRetained ga; for (int i = numChars - 1; i >= 0; i--) { ga = geometryList[i]; if ((ga != null) && ga.intersect(thisToOtherVworld, geom)) { return true; } } return false; }
// TODO -- Need to rethink. Might have to consider charTransform[] in returns pickInfo. @Override boolean intersect( PickShape pickShape, PickInfo pickInfo, int flags, Point3d iPnt, GeometryRetained geom, int geomIndex) { Transform3D tempT3D = new Transform3D(); GeometryArrayRetained geo = null; int sIndex = -1; PickShape newPS; double minDist = Double.MAX_VALUE; double distance = 0.0; Point3d closestIPnt = new Point3d(); for (int i = 0; i < numChars; i++) { geo = geometryList[i]; if (geo != null) { tempT3D.invert(charTransforms[i]); newPS = pickShape.transform(tempT3D); if (geo.intersect(newPS, pickInfo, flags, iPnt, geom, geomIndex)) { if (flags == 0) { return true; } distance = newPS.distance(iPnt); if (distance < minDist) { sIndex = i; minDist = distance; closestIPnt.set(iPnt); } } } } if (sIndex >= 0) { // We need to transform iPnt to the vworld to compute the actual distance. // In this method we'll transform iPnt by its char. offset. Shape3D will // do the localToVworld transform. iPnt.set(closestIPnt); charTransforms[sIndex].transform(iPnt); return true; } return false; }