Ejemplo n.º 1
0
  private void exhaustiveCheck(
      final Record rec, final Vector3d offset, final PolyTree ptree1, final PolyTree ptree2) {
    final Matrix4dX X21 = new Matrix4dX(rec.X21);
    final Matrix4dX X12 = new Matrix4dX();

    X21.m03 += offset.x;
    X21.m13 += offset.y;
    X21.m23 += offset.z;

    X12.invert(X21);

    final Vector flist1 = getAllPolyhdreonFeatures(ptree1.getPolyhedron());
    final Vector flist2 = getAllPolyhdreonFeatures(ptree2.getPolyhedron());
    for (final Iterator it1 = flist1.iterator(); it1.hasNext(); ) {
      final Feature f1 = (Feature) it1.next();
      for (final Iterator it2 = flist2.iterator(); it2.hasNext(); ) {
        final Feature f2 = (Feature) it2.next();

        if (!(f1.type == Feature.FACE && f2.type == Feature.FACE)) {
          final FeaturePair featurePair = new FeaturePair(f1, f2);
          final PolyTreePair ptreePair = new PolyTreePair(ptree1, ptree2);
          closestFeaturesHT.put(ptreePair, featurePair);

          final DistanceReport rep = rec.createDistanceReport();
          final double d = ptree1.vclip(rep, ptree2, X21, MAX_DIST, closestFeaturesHT);
          rep.transformSecondPoints(X21);
          checkVclipResults(rec, offset, rep, d, featurePair);
        }
      }
    }
  }
Ejemplo n.º 2
0
  private void singleCheck(
      final Record rec,
      final Vector3d offset,
      final PolyTree ptree1,
      final PolyTree ptree2,
      final String fname1,
      final String fname2) {
    final Matrix4dX X21 = new Matrix4dX(rec.X21);
    final Matrix4dX X12 = new Matrix4dX();

    X21.m03 += offset.x;
    X21.m13 += offset.y;
    X21.m23 += offset.z;

    X12.invert(X21);

    FeaturePair featurePair;
    if (fname1 != null) {
      Feature f1, f2;
      if (fname1.equals("")) f1 = ptree1.poly_.getVerts()[0];
      else f1 = ptree1.poly_.findFeature(fname1);
      if (fname1.equals("")) f2 = ptree2.poly_.getVerts()[0];
      else f2 = ptree2.poly_.findFeature(fname2);
      featurePair = new FeaturePair(f1, f2);
      final PolyTreePair ptreePair = new PolyTreePair(ptree1, ptree2);
      closestFeaturesHT.put(ptreePair, featurePair);
    } else {
      featurePair = (FeaturePair) closestFeaturesHT.get(new PolyTreePair(ptree1, ptree2));
      if (featurePair == null)
        featurePair = new FeaturePair(ptree1.poly_.getVerts()[0], ptree2.poly_.getVerts()[0]);
    }

    final DistanceReport rep = rec.createDistanceReport();
    final double d = ptree1.vclip(rep, ptree2, X21, MAX_DIST, closestFeaturesHT);
    rep.transformSecondPoints(X21);
    checkVclipResults(rec, offset, rep, d, featurePair);
  }