Esempio n. 1
0
 private void dumpList() {
   try {
     for (int i = 0; i < list.size(); i++) {
       System.out.println("QUEUE " + i + " " + list.get(i).name + " " + list.get(i).statusInfo);
     }
   } catch (Exception e) {
     return;
   }
 }
Esempio n. 2
0
 private boolean checkID(String thisID) {
   ellipsoidSet = new Lst<Ellipsoid>();
   if (thisID == null) return false;
   thisID = thisID.toLowerCase();
   if (PT.isWild(thisID)) {
     for (Entry<String, Ellipsoid> e : simpleEllipsoids.entrySet()) {
       String key = e.getKey().toLowerCase();
       if (PT.isMatch(key, thisID, true, true)) ellipsoidSet.addLast(e.getValue());
     }
   }
   Ellipsoid e = simpleEllipsoids.get(thisID);
   if (e != null) ellipsoidSet.addLast(e);
   return (ellipsoidSet.size() > 0);
 }
Esempio n. 3
0
  private void setOrbital(int moNumber, float[] linearCombination) {
    setPropI("reset", strID, null);
    if (moDebug) setPropI("debug", Boolean.TRUE, null);
    getSettings(strID);
    if (moScale != null) setPropI("scale", moScale, null);
    if (moResolution != null) setPropI("resolution", moResolution, null);
    if (moPlane != null) {
      setPropI("plane", moPlane, null);
      if (moCutoff != null) {
        setPropI("red", Float.valueOf(-moCutoff.floatValue()), null);
        setPropI("blue", moCutoff, null);
      }
    } else {
      if (moCutoff != null)
        setPropI((moIsPositiveOnly ? "cutoffPositive" : "cutoff"), moCutoff, null);
      if (moColorNeg != null) setPropI("colorRGB", moColorNeg, null);
      if (moColorPos != null) setPropI("colorRGB", moColorPos, null);
      if (moMonteCarloCount != null) {
        setPropI("randomSeed", moRandomSeed, null);
        setPropI("monteCarloCount", moMonteCarloCount, null);
      }
    }
    setPropI("squareData", moSquareData, null);
    setPropI("squareLinear", moSquareLinear, null);
    setPropI("title", moTitleFormat, null);
    setPropI("fileName", vwr.getFileName(), null);
    setPropI(
        "molecularOrbital",
        linearCombination == null ? Integer.valueOf(moNumber) : linearCombination,
        null);
    if (moPlane != null && moColorNeg != null) setPropI("colorRGB", moColorNeg, null);
    if (moPlane != null && moColorPos != null) setPropI("colorRGB", moColorPos, null);
    currentMesh.isColorSolid = false;
    if (moSlabValue != null) setPropI("slab", moSlabValue, null);
    if (moSlab != null)
      for (int i = 0; i < moSlab.size(); i++) setPropI("slab", moSlab.get(i), null);
    if (moTranslucentLevel != null) setPropI("translucentLevel", moTranslucentLevel, null);
    if (moTranslucency != null) setPropI("translucency", moTranslucency, null);
    setPropI("token", Integer.valueOf(moFill), null);
    setPropI("token", Integer.valueOf(moMesh), null);
    setPropI("token", Integer.valueOf(moDots), null);
    setPropI("token", Integer.valueOf(moFrontOnly), null);

    thisModel.put("mesh", currentMesh);
    return;
  }
Esempio n. 4
0
 private double normalizeShell(int iShell) {
   double c = 0;
   int[] shell = shells.get(iShell);
   basisType = QS.getItem(shell[1]);
   gaussianPtr = shell[2];
   nGaussians = shell[3];
   doShowShellType = doDebug;
   if (!setCoeffs(false)) return 0;
   for (int i = map.length; --i >= 0; ) c += coeffs[i] * coeffs[i];
   return c;
 }
Esempio n. 5
0
 @Override
 protected void renderBioShape(BioShape bioShape) {
   boolean showSteps = vwr.getBoolean(T.backbonesteps) && bioShape.bioPolymer.isNucleic();
   isDataFrame = vwr.ms.isJmolDataFrameForModel(bioShape.modelIndex);
   for (int i = bsVisible.nextSetBit(0); i >= 0; i = bsVisible.nextSetBit(i + 1)) {
     Atom atomA = ms.at[leadAtomIndices[i]];
     short cA = colixes[i];
     mad = mads[i];
     drawSegment(atomA, ms.at[leadAtomIndices[i + 1]], cA, colixes[i + 1], 100);
     if (showSteps) {
       NucleicMonomer g = (NucleicMonomer) monomers[i];
       Lst<BasePair> bps = g.getBasePairs();
       if (bps != null) {
         for (int j = bps.size(); --j >= 0; ) {
           int iAtom = bps.get(j).getPartnerAtom(g);
           if (iAtom > i) drawSegment(atomA, ms.at[iAtom], cA, cA, 1000);
         }
       }
     }
   }
 }
Esempio n. 6
0
 @Override
 protected void setSize(int size, BS bsSelected) {
   if (ms.at == null || size == 0 && ms.atomTensors == null) return;
   boolean isAll = (bsSelected == null);
   if (!isAll && selectedAtoms != null) bsSelected = selectedAtoms;
   Lst<Object> tensors = vwr.ms.getAllAtomTensors(typeSelected);
   if (tensors == null) return;
   Atom[] atoms = ms.at;
   for (int i = tensors.size(); --i >= 0; ) {
     Tensor t = (Tensor) tensors.get(i);
     if (isAll || t.isSelected(bsSelected, -1)) {
       Ellipsoid e = atomEllipsoids.get(t);
       boolean isNew = (size != 0 && e == null);
       if (isNew)
         atomEllipsoids.put(t, e = Ellipsoid.getEllipsoidForAtomTensor(t, atoms[t.atomIndex1]));
       if (e != null && (isNew || size != Integer.MAX_VALUE)) { // MAX_VALUE --> "create only"
         e.setScale(size, true);
       }
     }
   }
 }
Esempio n. 7
0
 void addJob(NBOService nboService, String name, String statusInfo, Runnable process) {
   synchronized (lock) {
     if (list.size() > QUEUE_MAX) {
       if (thisJob != null) {
         Logger.info(
             "NBOJobQueneManager: max queue reached -- canceling jobs and clearing the queue");
         cancelJob();
         clearQueue();
       }
     }
     if (name.equals("clear")) {
       cancelJob();
     } else {
       System.out.println("adding job " + list.size() + ": " + name + "; " + statusInfo);
       list.addLast(new NBOJob(nboService, name, statusInfo, process));
       dumpList();
     }
   }
   if (queueThread == null || !running) {
     queueThread = new NBOQueueThread();
     running = true;
     queueThread.start();
   }
 }
Esempio n. 8
0
 private void processShell(int iShell) {
   int lastAtom = atomIndex;
   int[] shell = shells.get(iShell);
   atomIndex = shell[0] + firstAtomOffset;
   basisType = QS.getItem(shell[1]);
   gaussianPtr = shell[2];
   nGaussians = shell[3];
   doShowShellType = doDebug;
   if (atomIndex != lastAtom && (thisAtom = qmAtoms[atomIndex]) != null)
     thisAtom.setXYZ(this, true);
   if (!setCoeffs(true)) return;
   if (havePoints) setMinMax(-1);
   switch (basisType) {
     case S:
       addDataS();
       break;
     case P:
       addDataP();
       break;
     case SP:
       addDataSP();
       break;
     case D_SPHERICAL:
       addData5D();
       break;
     case D_CARTESIAN:
       addData6D();
       break;
     case F_SPHERICAL:
       addData7F();
       break;
     case F_CARTESIAN:
       addData10F();
       break;
     default:
       Logger.warn(" Unsupported basis type for atomno=" + (atomIndex + 1) + ": " + basisType.tag);
       break;
   }
 }
Esempio n. 9
0
 @Override
 protected void process() {
   atomIndex = firstAtomOffset - 1;
   moCoeff = 0;
   if (slaters == null) {
     // each STO shell is the combination of one or more gaussians
     int nShells = shells.size();
     // Logger.info("Processing " + nShells + " Gaussian  shells");
     if (c < 0) {
       c = 0;
       for (int i = 0; i < nShells; i++) c += normalizeShell(i);
       // System.out.println("sum[c^2] = " + c + "\t" + Math.sqrt(c));
       c = Math.sqrt(c);
       atomIndex = firstAtomOffset - 1;
       moCoeff = 0;
     }
     for (int i = 0; i < nShells; i++) processShell(i);
     return;
   }
   for (int i = 0; i < slaters.length; i++) {
     if (!processSlater(i)) break;
   }
 }
Esempio n. 10
0
  @Override
  public void setProperty(String propertyName, Object value, BS bs) {
    // System.out.println(propertyName + " " + value + " " + bs);
    if (propertyName == "thisID") {
      if (initEllipsoids(value) && ellipsoidSet.size() == 0) {
        String id = (String) value;
        Ellipsoid e = Ellipsoid.getEmptyEllipsoid(id, vwr.am.cmi);
        ellipsoidSet.addLast(e);
        simpleEllipsoids.put(id, e);
      }
      return;
    }

    if ("atoms" == propertyName) {
      selectedAtoms = (BS) value;
      return;
    }

    if (propertyName == "deleteModelAtoms") {
      int modelIndex = ((int[]) ((Object[]) value)[2])[0];
      Iterator<Ellipsoid> e = simpleEllipsoids.values().iterator();
      while (e.hasNext()) if (e.next().tensor.modelIndex == modelIndex) e.remove();
      e = atomEllipsoids.values().iterator();
      while (e.hasNext()) if (e.next().modelIndex == modelIndex) e.remove();
      ellipsoidSet.clear();
      return;
    }
    int mode = PROPERTY_MODES.indexOf((propertyName + "  ").substring(0, 2));
    if (ellipsoidSet.size() > 0) {
      if ("translucentLevel" == propertyName) {
        setPropS(propertyName, value, bs);
        return;
      }
      if (mode >= 0)
        for (int i = ellipsoidSet.size(); --i >= 0; ) setProp(ellipsoidSet.get(i), mode / 3, value);
      return;
    }

    if ("color" == propertyName) {
      short colix = C.getColixO(value);
      byte pid = PAL.pidOf(value);
      if (selectedAtoms != null) bs = selectedAtoms;
      for (Ellipsoid e : atomEllipsoids.values())
        if (e.tensor.type.equals(typeSelected) && e.tensor.isSelected(bs, -1)) {
          e.colix = getColixI(colix, pid, e.tensor.atomIndex1);
          e.pid = pid;
        }
      return;
    }

    if ("on" == propertyName) {
      boolean isOn = ((Boolean) value).booleanValue();
      if (selectedAtoms != null) bs = selectedAtoms;
      if (isOn) setSize(Integer.MAX_VALUE, bs);
      for (Ellipsoid e : atomEllipsoids.values()) {
        Tensor t = e.tensor;
        if ((t.type.equals(typeSelected) || typeSelected.equals(t.altType))
            && t.isSelected(bs, -1)) {
          e.isOn = isOn;
        }
      }
      return;
    }

    if ("options" == propertyName) {
      String options = ((String) value).toLowerCase().trim();
      if (options.length() == 0) options = null;
      if (selectedAtoms != null) bs = selectedAtoms;
      if (options != null) setSize(Integer.MAX_VALUE, bs);
      for (Ellipsoid e : atomEllipsoids.values())
        if (e.tensor.type.equals(typeSelected) && e.tensor.isSelected(bs, -1)) e.options = options;
      return;
    }

    if ("params" == propertyName) {
      Object[] data = (Object[]) value;
      data[2] = null; // Jmol does not allow setting sizes this way from PyMOL yet
      typeSelected = "0";
      setSize(50, bs);
      // onward...
    }

    if ("points" == propertyName) {
      // Object[] o = (Object[]) value;
      // setPoints((P3[]) o[1], (BS) o[2]);
      return;
    }

    if ("scale" == propertyName) {
      setSize((int) (((Float) value).floatValue() * 100), bs);
      return;
    }

    if ("select" == propertyName) {
      typeSelected = ((String) value).toLowerCase();
      return;
    }

    if ("translucency" == propertyName) {
      boolean isTranslucent = (value.equals("translucent"));
      for (Ellipsoid e : atomEllipsoids.values())
        if (e.tensor.type.equals(typeSelected) && e.tensor.isSelected(bs, -1))
          e.colix = C.getColixTranslucent3(e.colix, isTranslucent, translucentLevel);
      return;
    }
    setPropS(propertyName, value, bs);
  }
Esempio n. 11
0
  /**
   * @param distance a distance from a plane or point
   * @param plane a slabbing plane
   * @param ptCenters a set of atoms to measure distance from
   * @param vData when not null, this is a query, not an actual slabbing
   * @param fData vertex values or other data to overlay
   * @param bsSource TODO
   * @param meshSurface second surface; not implemented -- still some problems there
   * @param andCap to cap this off, crudely only
   * @param doClean compact set - draw only
   * @param tokType type of slab
   * @param isGhost translucent slab, so we mark slabbed triangles
   */
  public void getIntersection(
      float distance,
      P4 plane,
      P3[] ptCenters,
      Lst<P3[]> vData,
      float[] fData,
      BS bsSource,
      MeshSurface meshSurface,
      boolean andCap,
      boolean doClean,
      int tokType,
      boolean isGhost) {
    boolean isSlab = (vData == null);
    P3[] pts = null;
    if (fData == null) {
      if (tokType == T.decimal && bsSource != null) {
        if (vertexSource == null) return;
        fData = new float[vc];
        for (int i = 0; i < vc; i++)
          if ((fData[i] = vertexSource[i]) == -1) System.out.println("meshsurface hmm");
      } else {
        fData = vvs;
      }
    }
    Map<String, Integer> mapEdge = new Hashtable<String, Integer>();

    /*
    Vector3f vNorm = null;
    Vector3f vBC = null;
    Vector3f vAC = null;
    Point3f[] pts2 = null;
    Vector3f vTemp3 = null;
    Point4f planeTemp = null;
    boolean isMeshIntersect = (meshSurface != null);
    if (isMeshIntersect) {
      // NOT IMPLEMENTED
      vBC = new Vector3f();
      vAC = new Vector3f();
      vNorm = new Vector3f();
      plane = new Point4f();
      planeTemp = new Point4f();
      vTemp3 = new Vector3f();
      pts2 = new Point3f[] { null, new Point3f(), new Point3f() };
    }
    */
    if (ptCenters != null || isGhost)
      andCap = false; // can only cap faces, and no capping of ghosts
    float[] values = new float[2];
    float[] fracs = new float[2];
    double absD = Math.abs(distance);
    float d1, d2, d3, valA, valB, valC;
    int sourceA = 0, sourceB = 0, sourceC = 0, setA = 0;
    Lst<int[]> iPts = (andCap ? new Lst<int[]>() : null);
    if (pc == 0) {
      for (int i = mergeVertexCount0; i < vc; i++) {
        if (Float.isNaN(fData[i])
            || checkSlab(tokType, vs[i], fData[i], distance, plane, ptCenters, bsSource) > 0)
          bsSlabDisplay.clear(i);
      }
      return;
    }
    int iLast = pc;
    for (int i = mergePolygonCount0; i < iLast; i++) {
      if (!setABC(i)) continue;
      BS bsSlab = (bsSlabGhost != null && bsSlabGhost.get(i) ? bsSlabGhost : bsSlabDisplay);
      int check1 = pis[i][3];
      int check2 = (checkCount == 2 ? pis[i][4] : 0);
      T3 vA = vs[iA];
      T3 vB = vs[iB];
      T3 vC = vs[iC];
      valA = fData[iA];
      valB = fData[iB];
      valC = fData[iC];
      if (vertexSource != null) {
        sourceA = vertexSource[iA];
        sourceB = vertexSource[iB];
        sourceC = vertexSource[iC];
      }
      if (vertexSets != null) setA = vertexSets[iA];
      d1 =
          checkSlab(
              tokType,
              vA,
              valA,
              (bsSource == null ? distance : sourceA),
              plane,
              ptCenters,
              bsSource);
      d2 =
          checkSlab(
              tokType,
              vB,
              valB,
              (bsSource == null ? distance : sourceB),
              plane,
              ptCenters,
              bsSource);
      d3 =
          checkSlab(
              tokType,
              vC,
              valC,
              (bsSource == null ? distance : sourceC),
              plane,
              ptCenters,
              bsSource);
      int test1 =
          (d1 != 0 && d1 < 0 ? 1 : 0) + (d2 != 0 && d2 < 0 ? 2 : 0) + (d3 != 0 && d3 < 0 ? 4 : 0);

      /*
            if (iA == 955 || iB == 955 || iC == 955) {
              System.out.println(i + " " + iA + " " + iB + " " + iC + " "+ d1 + " " + d2 + " " + d3 + " " + test1);
              System.out.println("testing messhsurf ");
            }
      */
      /*
      if (isMeshIntersect && test1 != 7 && test1 != 0) {
        // NOT IMPLEMENTED
        boolean isOK = (d1 == 0 && d2 * d3 >= 0 || d2 == 0 && (d1 * d3) >= 0 || d3 == 0
            && d1 * d2 >= 0);
        if (isOK)
          continue;
        // We have a potential crossing. Now to find the exact point of crossing
        // the other isosurface.
        if (checkIntersection(vA, vB, vC, meshSurface, pts2, vNorm, vBC, vAC,
            plane, planeTemp, vTemp3)) {
          iD = addIntersectionVertex(pts2[0], 0, sourceA, mapEdge, -1, -1); // have to choose some source
          addPolygon(iA, iB, iD, check1 & 1, check2, 0, bsSlabDisplay);
          addPolygon(iD, iB, iC, check1 & 2, check2, 0, bsSlabDisplay);
          addPolygon(iA, iD, iC, check1 & 4, check2, 0, bsSlabDisplay);
          test1 = 0; // toss original
          iLast = polygonCount;
        } else {
          // process normally for now
          // not fully implemented -- need to check other way as well.
        }
      }
      */
      switch (test1) {
        default:
        case 7:
        case 0:
          // all on the same side
          break;
        case 1:
        case 6:
          // BC on same side
          if (ptCenters == null)
            pts =
                new P3[] {
                  interpolatePoint(vA, vB, -d1, d2, valA, valB, values, fracs, 0),
                  interpolatePoint(vA, vC, -d1, d3, valA, valC, values, fracs, 1)
                };
          else
            pts =
                new P3[] {
                  interpolateSphere(vA, vB, -d1, -d2, absD, valA, valB, values, fracs, 0),
                  interpolateSphere(vA, vC, -d1, -d3, absD, valA, valC, values, fracs, 1)
                };
          break;
        case 2:
        case 5:
          // AC on same side
          if (ptCenters == null)
            pts =
                new P3[] {
                  interpolatePoint(vB, vA, -d2, d1, valB, valA, values, fracs, 1),
                  interpolatePoint(vB, vC, -d2, d3, valB, valC, values, fracs, 0)
                };
          else
            pts =
                new P3[] {
                  interpolateSphere(vB, vA, -d2, -d1, absD, valB, valA, values, fracs, 1),
                  interpolateSphere(vB, vC, -d2, -d3, absD, valB, valC, values, fracs, 0)
                };
          break;
        case 3:
        case 4:
          // AB on same side need A-C, B-C
          if (ptCenters == null)
            pts =
                new P3[] {
                  interpolatePoint(vC, vA, -d3, d1, valC, valA, values, fracs, 0),
                  interpolatePoint(vC, vB, -d3, d2, valC, valB, values, fracs, 1)
                };
          else
            pts =
                new P3[] {
                  interpolateSphere(vC, vA, -d3, -d1, absD, valC, valA, values, fracs, 0),
                  interpolateSphere(vC, vB, -d3, -d2, absD, valC, valB, values, fracs, 1)
                };
          break;
      }
      doClear = true;
      doGhost = isGhost;
      doCap = andCap;
      BS bs;
      // adjust for minor discrepencies
      // for (int j = 0; j < 2; j++)
      // if (fracs[j] == 0)
      // fracs[1 - j] = (fracs[1 - j] < 0.5 ? 0 : 1);

      if (isSlab) {
        //        iD = iE = -1;
        switch (test1) {
            //             A
            //            / \
            //           B---C
          case 0:
            // all on the same side -- toss
            doCap = false;
            break;
          case 7:
            // all on the same side -- keep
            continue;
          case 1:
          case 6:
            //          0  A  0
            //            / \
            //        0 -------- 1
            //          /     \
            //       1 B-------C  1
            boolean tossBC = (test1 == 1);
            if (tossBC || isGhost) {
              // 1: BC on side to toss -- +tossBC+isGhost  -tossBC+isGhost
              if (!getDE(fracs, 0, iA, iB, iC, tossBC)) break;
              if (iD < 0)
                iD = addIntersectionVertex(pts[0], values[0], sourceA, setA, mapEdge, iA, iB);
              if (iE < 0)
                iE = addIntersectionVertex(pts[1], values[1], sourceA, setA, mapEdge, iA, iC);
              bs = (tossBC ? bsSlab : bsSlabGhost);
              addPolygonV3(iA, iD, iE, check1 & 5 | 2, check2, 0, bs);
              if (!isGhost) break;
            }
            // BC on side to keep -- -tossBC+isGhost,  +tossBC+isGhost
            if (!getDE(fracs, 1, iA, iC, iB, tossBC)) break;
            bs = (tossBC ? bsSlabGhost : bsSlab);
            if (iE < 0) {
              iE = addIntersectionVertex(pts[0], values[0], sourceB, setA, mapEdge, iA, iB);
              addPolygonV3(iE, iB, iC, check1 & 3, check2, 0, bs);
            }
            if (iD < 0) {
              iD = addIntersectionVertex(pts[1], values[1], sourceC, setA, mapEdge, iA, iC);
              addPolygonV3(iD, iE, iC, check1 & 4 | 1, check2, 0, bs);
            }
            break;
          case 5:
          case 2:
            //              A
            //            \/ \
            //            /\  \
            //           B--\--C
            //               \
            //
            boolean tossAC = (test1 == 2);
            if (tossAC || isGhost) {
              // AC on side to toss
              if (!getDE(fracs, 0, iB, iC, iA, tossAC)) break;
              bs = (tossAC ? bsSlab : bsSlabGhost);
              if (iE < 0)
                iE = addIntersectionVertex(pts[0], values[0], sourceB, setA, mapEdge, iB, iA);
              if (iD < 0)
                iD = addIntersectionVertex(pts[1], values[1], sourceB, setA, mapEdge, iB, iC);
              addPolygonV3(iE, iB, iD, check1 & 3 | 4, check2, 0, bs);
              if (!isGhost) break;
            }
            // AC on side to keep
            if (!getDE(fracs, 1, iB, iA, iC, tossAC)) break;
            bs = (tossAC ? bsSlabGhost : bsSlab);
            if (iD < 0) {
              iD = addIntersectionVertex(pts[0], values[0], sourceA, setA, mapEdge, iB, iA);
              addPolygonV3(iA, iD, iC, check1 & 5, check2, 0, bs);
            }
            if (iE < 0) {
              iE = addIntersectionVertex(pts[1], values[1], sourceC, setA, mapEdge, iB, iC);
              addPolygonV3(iD, iE, iC, check1 & 2 | 1, check2, 0, bs);
            }
            break;
          case 4:
          case 3:
            //              A
            //             / \/
            //            /  /\
            //           B--/--C
            //             /
            //
            boolean tossAB = (test1 == 4);
            if (tossAB || isGhost) {
              if (!getDE(fracs, 0, iC, iA, iB, tossAB)) break;
              if (iD < 0)
                iD = addIntersectionVertex(pts[0], values[0], sourceC, setA, mapEdge, iA, iC); // CA
              if (iE < 0)
                iE = addIntersectionVertex(pts[1], values[1], sourceC, setA, mapEdge, iB, iC); // CB
              bs = (tossAB ? bsSlab : bsSlabGhost);
              addPolygonV3(iD, iE, iC, check1 & 6 | 1, check2, 0, bs);
              if (!isGhost) break;
            }
            // AB on side to keep
            if (!getDE(fracs, 1, iC, iB, iA, tossAB)) break;
            bs = (tossAB ? bsSlabGhost : bsSlab);
            if (iE < 0) {
              iE = addIntersectionVertex(pts[0], values[0], sourceA, setA, mapEdge, iA, iC); // CA
              addPolygonV3(iA, iB, iE, check1 & 5, check2, 0, bs);
            }
            if (iD < 0) {
              iD = addIntersectionVertex(pts[1], values[1], sourceB, setA, mapEdge, iB, iC); // CB
              addPolygonV3(iE, iB, iD, check1 & 2 | 4, check2, 0, bs);
            }
            break;
        }
        if (doClear) {
          bsSlab.clear(i);
          if (doGhost) bsSlabGhost.set(i);
        }
        if (doCap) {
          iPts.addLast(new int[] {iD, iE});
        }
      } else if (pts != null) {
        vData.addLast(pts);
      }
    }
    if (andCap && iPts.size() > 0) {
      P3 center = new P3();
      for (int i = iPts.size(); --i >= 0; ) {
        int[] ipts = iPts.get(i);
        center.add(vs[ipts[0]]);
        center.add(vs[ipts[1]]);
      }
      center.scale(0.5f / iPts.size());
      int v0 = addIntersectionVertex(center, 0, -1, setA, mapEdge, -1, -1);
      for (int i = iPts.size(); --i >= 0; ) {
        int[] ipts = iPts.get(i);
        // int p =
        addPolygonV3(ipts[0], v0, ipts[1], 0, 0, 0, bsSlabDisplay);
      }
    }

    if (!doClean) return;
    BS bsv = new BS();
    BS bsp = new BS();
    for (int i = 0; i < pc; i++) {
      if (pis[i] == null) continue;
      bsp.set(i);
      for (int j = 0; j < 3; j++) bsv.set(pis[i][j]);
    }
    int n = 0;
    int nPoly = bsp.cardinality();
    if (nPoly != pc) {
      int[] map = new int[vc];
      for (int i = 0; i < vc; i++) if (bsv.get(i)) map[i] = n++;
      T3[] vTemp = new P3[n];
      n = 0;
      for (int i = 0; i < vc; i++) if (bsv.get(i)) vTemp[n++] = vs[i];
      int[][] pTemp = AU.newInt2(nPoly);
      nPoly = 0;
      for (int i = 0; i < pc; i++)
        if (pis[i] != null) {
          for (int j = 0; j < 3; j++) pis[i][j] = map[pis[i][j]];
          pTemp[nPoly++] = pis[i];
        }
      vs = vTemp;
      vc = n;
      pis = pTemp;
      pc = nPoly;
    }
  }
Esempio n. 12
0
 public void slabPolygonsList(Lst<Object[]> slabInfo, boolean allowCap) {
   for (int i = 0; i < slabInfo.size(); i++) if (!slabPolygons(slabInfo.get(i), allowCap)) break;
 }
Esempio n. 13
0
 void clearQueue() {
   list.clear();
 }