Package javax.vecmath

Examples of javax.vecmath.Point3f


        iHaveAtoms = true;
        break;
      case Token.leftbrace:
      case Token.point3f:
        // {X, Y, Z}
        Point3f pt = getPoint3f(i, true);
        i = iToken;
        propertyName = (iHaveAtoms || iHaveCoord ? "endCoord" : "startCoord");
        propertyValue = pt;
        iHaveCoord = true;
        break;
View Full Code Here


    if (atomsOrBonds == Token.connect) {
      index2 = atomExpression(++iToken).nextSetBit(0);
    } else {
      type = parameterAsString(++iToken);
    }
    Point3f pt = (++iToken < statementLength ? centerParameter(iToken) : null);
    if (isSyntaxCheck)
      return;
    switch (atomsOrBonds) {
    case Token.atoms:
      viewer.assignAtom(index, pt, type);
View Full Code Here

        setStringProperty(key, sval);
      }
      break;
    case Token.defaultlattice:
      if (statementLength > 2) {
        Point3f pt;
        ScriptVariable var = parameterExpressionToken(2);
        if (var.tok == Token.point3f)
          pt = (Point3f) var.value;
        else {
          int ijk = ScriptVariable.iValue(var);
          if (ijk < 555)
            pt = new Point3f();
          else
            pt = viewer.getSymmetry().ijkToPoint3f(ijk + 111);
        }
        if (!isSyntaxCheck)
          viewer.setDefaultLattice(pt);
View Full Code Here

    if (byCorner)
      index++;
    if (isCenterParameter(index)) {
      expressionResult = null;
      int index0 = index;
      Point3f pt1 = centerParameter(index);
      index = iToken + 1;
      if (byCorner || isCenterParameter(index)) {
        // boundbox CORNERS {expressionOrPoint1} {expressionOrPoint2}
        // boundbox {expressionOrPoint1} {vector}
        Point3f pt2 = (byCorner ? centerParameter(index) : getPoint3f(index,
            true));
        index = iToken + 1;
        if (!isSyntaxCheck)
          viewer.setBoundBox(pt1, pt2, byCorner, scale);
      } else if (expressionResult != null && expressionResult instanceof BitSet) {
View Full Code Here

      return tickInfo;
    }
    tickInfo = new TickInfo((Point3f) getPointOrPlane(index, false, true,
        false, false, 3, 3));
    if (coordinatesAreFractional || tokAt(iToken + 1) == Token.unitcell) {
      tickInfo.scale = new Point3f(Float.NaN, Float.NaN, Float.NaN);
      allowScale = false;
    }
    if (tokAt(iToken + 1) == Token.unitcell)
      iToken++;
    tickInfo.type = str;
    if (tokAt(iToken + 1) == Token.format)
      tickInfo.tickLabelFormats = stringParameterSet(iToken + 2);
    if (!allowScale)
      return tickInfo;
    if (tokAt(iToken + 1) == Token.scale) {
      if (isFloatParameter(iToken + 2)) {
        float f = floatParameter(iToken + 2);
        tickInfo.scale = new Point3f(f, f, f);
      } else {
        tickInfo.scale = getPoint3f(iToken + 2, true);
      }
    }
    if (allowFirst)
View Full Code Here

  }

  private void unitcell(int index) throws ScriptException {
    int icell = Integer.MAX_VALUE;
    int mad = Integer.MAX_VALUE;
    Point3f pt = null;
    TickInfo tickInfo = checkTicks(index, true, false, false);
    index = iToken;
    if (statementLength == index + 2) {
      if (getToken(index + 1).tok == Token.integer
          && intParameter(index + 1) >= 111)
View Full Code Here

            ScriptVariable.sValue(tokenAt(isCommand ? 2 : 1, args)), Token.variable));
        type = "TXT";
      } else if (data == "SPT") {
        if (isCoord) {
          BitSet tainted = viewer.getTaintedAtoms(AtomCollection.TAINT_COORD);
          viewer.setAtomCoordRelative(new Point3f(0, 0, 0), null);
          data = (String) viewer.getProperty("string", "stateInfo", null);
          viewer.setTaintedAtoms(tainted, AtomCollection.TAINT_COORD);
        } else {
          data = (String) viewer.getProperty("string", "stateInfo", null);
          if (localPath != null || remotePath != null)
View Full Code Here

    float translucentLevel = Float.MAX_VALUE;
    int colorArgb = Integer.MIN_VALUE;
    int intScale = 0;
    String swidth = "";
    int iptDisplayProperty = 0;
    Point3f center = null;
    String thisId = initIsosurface(JmolConstants.SHAPE_DRAW);
    boolean idSeen = (thisId != null);
    boolean isWild = (idSeen && getShapeProperty(JmolConstants.SHAPE_DRAW, "ID") == null);
    for (int i = iToken; i < statementLength; ++i) {
      String propertyName = null;
      Object propertyValue = null;
      switch (getToken(i).tok) {
      case Token.unitcell:
      case Token.boundbox:
        if (isSyntaxCheck)
          break;
        List vp = viewer.getPlaneIntersection(theTok, null, intScale / 100f,
            0);
        intScale = 0;
        propertyName = "polygon";
        propertyValue = vp;
        havePoints = true;
        break;
      case Token.intersection:
        switch (getToken(++i).tok) {
        case Token.unitcell:
        case Token.boundbox:
          tokIntersect = theTok;
          isIntersect = true;
          continue;
        case Token.dollarsign:
          propertyName = "intersect";
          propertyValue = objectNameParameter(++i);
          i = iToken;
          isIntersect = true;
          havePoints = true;
          break;
        default:
          error(ERROR_invalidArgument);
        }
        break;
      case Token.polygon:
        int nVertices = intParameter(++i);
        Point3f[] points = new Point3f[nVertices];
        for (int j = 0; j < nVertices; j++, i = iToken)
          points[j] = getPoint3f(++iToken, true);
        List v = new ArrayList();
        v.add(points);
        int nTriangles = intParameter(++i);
        int[][] polygons = new int[nTriangles][];
        for (int j = 0; j < nTriangles; j++, i = iToken) {
          float[] f = floatParameterSet(++i, 3, 4);
          polygons[j] = new int[] { (int) f[0], (int) f[1], (int) f[2],
              (f.length == 3 ? 7 : (int) f[3]) };
        }
        if (nVertices == 0)
          v = null;
        else
          v.add(polygons);
        propertyName = "polygon";
        propertyValue = v;
        havePoints = true;
        break;
      case Token.symop:
        String xyz = null;
        int iSym = 0;
        plane = null;
        Point3f target = null;
        switch (tokAt(++i)) {
        case Token.string:
          xyz = stringParameter(i);
          break;
        case Token.matrix4f:
          xyz = ScriptVariable.sValue(getToken(i));
          break;
        case Token.integer:
        default:
          if (!isCenterParameter(i))
            iSym = intParameter(i++);
          if (isCenterParameter(i))
            center = centerParameter(i);
          if (isCenterParameter(iToken + 1))
            target = centerParameter(++iToken);
          if (isSyntaxCheck)
            return;
          i = iToken;
        }
        BitSet bsAtoms = null;
        if (center == null && i + 1 < statementLength) {
          center = centerParameter(++i);
          // draw ID xxx symop [n or "x,-y,-z"] [optional {center}]
          // so we also check here for the atom set to get the right model
          bsAtoms = (tokAt(i) == Token.bitset
              || tokAt(i) == Token.expressionBegin ? atomExpression(i) : null);
          i = iToken + 1;
        }
        checkLast(iToken);
        if (!isSyntaxCheck)
          runScript((String) viewer.getSymmetryInfo(bsAtoms, xyz, iSym, center,
              target, thisId, Token.draw));
        return;
      case Token.frame:
        isFrame = true;
        // draw ID xxx frame {center} {q1 q2 q3 q4}
        continue;
      case Token.leftbrace:
      case Token.point4f:
      case Token.point3f:
        // {X, Y, Z}
        if (theTok == Token.point4f || !isPoint3f(i)) {
          propertyValue = getPoint4f(i);
          if (isFrame) {
            checkLast(iToken);
            if (!isSyntaxCheck)
              runScript((new Quaternion((Point4f) propertyValue)).draw(
                  (thisId == null ? "frame" : thisId), " " + swidth,
                  (center == null ? new Point3f() : center), intScale / 100f));
            return;
          }
          propertyName = "planedef";
        } else {
          propertyValue = center = getPoint3f(i, true);
          propertyName = "coord";
        }
        i = iToken;
        havePoints = true;
        break;
      case Token.hkl:
      case Token.plane:
        if (!havePoints && !isIntersect && tokIntersect == 0
            && theTok != Token.hkl) {
          propertyName = "plane";
          break;
        }
        if (theTok == Token.plane) {
          plane = planeParameter(++i);
        } else {
          plane = hklParameter(++i);
        }
        i = iToken;
        if (tokIntersect != 0) {
          if (isSyntaxCheck)
            break;
          List vpc = viewer.getPlaneIntersection(tokIntersect, plane,
              intScale / 100f, 0);
          intScale = 0;
          propertyName = "polygon";
          propertyValue = vpc;
        } else {
          propertyValue = plane;
          propertyName = "planedef";
        }
        havePoints = true;
        break;
      case Token.linedata:
        propertyName = "lineData";
        propertyValue = floatParameterSet(++i, 0, Integer.MAX_VALUE);
        i = iToken;
        havePoints = true;
        break;
      case Token.bitset:
      case Token.expressionBegin:
        propertyName = "atomSet";
        propertyValue = atomExpression(i);
        if (isFrame)
          center = centerParameter(i);
        i = iToken;
        havePoints = true;
        break;
      case Token.varray:
        propertyName = "modelBasedPoints";
        propertyValue = ScriptVariable.listValue(theToken);
        havePoints = true;
        break;
      case Token.spacebeforesquare:
      case Token.comma:
        break;
      case Token.leftsquare:
        // [x y] or [x y %]
        propertyValue = xypParameter(i);
        if (propertyValue != null) {
          i = iToken;
          propertyName = "coord";
          havePoints = true;
          break;
        }
        if (isSavedState)
          error(ERROR_invalidArgument);
        isSavedState = true;
        break;
      case Token.rightsquare:
        if (!isSavedState)
          error(ERROR_invalidArgument);
        isSavedState = false;
        break;
      case Token.reverse:
        propertyName = "reverse";
        break;
      case Token.string:
        propertyValue = stringParameter(i);
        propertyName = "title";
        break;
      case Token.vector:
        propertyName = "vector";
        break;
      case Token.length:
        propertyValue = new Float(floatParameter(++i));
        propertyName = "length";
        break;
      case Token.decimal:
        // $drawObject
        propertyValue = new Float(floatParameter(i));
        propertyName = "length";
        break;
      case Token.modelindex:
        propertyName = "modelIndex";
        propertyValue = new Integer(intParameter(++i));
        break;
      case Token.integer:
        if (isSavedState) {
          propertyName = "modelIndex";
          propertyValue = new Integer(intParameter(i));
        } else {
          intScale = intParameter(i);
        }
        break;
      case Token.scale:
        if (++i >= statementLength)
          error(ERROR_numberExpected);
        switch (getToken(i).tok) {
        case Token.integer:
          intScale = intParameter(i);
          continue;
        case Token.decimal:
          intScale = (int) (floatParameter(i) * 100);
          continue;
        }
        error(ERROR_numberExpected);
        break;
      case Token.id:
        thisId = setShapeId(JmolConstants.SHAPE_DRAW, ++i, idSeen);
        isWild = (getShapeProperty(JmolConstants.SHAPE_DRAW, "ID") == null);
        i = iToken;
        break;
      case Token.modelbased:
        propertyName = "fixed";
        propertyValue = Boolean.FALSE;
        break;
      case Token.fixed:
        propertyName = "fixed";
        propertyValue = Boolean.TRUE;
        break;
      case Token.offset:
        Point3f pt = getPoint3f(++i, true);
        i = iToken;
        propertyName = "offset";
        propertyValue = pt;
        break;
      case Token.crossed:
        propertyName = "crossed";
        break;
      case Token.width:
        propertyValue = new Float(floatParameter(++i));
        propertyName = "width";
        swidth = (String) propertyName + " " + propertyValue;
        break;
      case Token.line:
        propertyName = "line";
        propertyValue = Boolean.TRUE;
        break;
      case Token.curve:
        propertyName = "curve";
        break;
      case Token.arc:
        propertyName = "arc";
        break;
      case Token.arrow:
        propertyName = "arrow";
        break;
      case Token.circle:
        propertyName = "circle";
        break;
      case Token.cylinder:
        propertyName = "cylinder";
        break;
      case Token.vertices:
        propertyName = "vertices";
        break;
      case Token.nohead:
        propertyName = "nohead";
        break;
      case Token.rotate45:
        propertyName = "rotate45";
        break;
      case Token.perpendicular:
        propertyName = "perp";
        break;
      case Token.diameter:
        float f = floatParameter(++i);
        propertyValue = new Float(f);
        propertyName = (tokAt(i) == Token.decimal ? "width" : "diameter");
        swidth = (String) propertyName
            + (tokAt(i) == Token.decimal ? " " + f : " " + ((int) f));
        break;
      case Token.dollarsign:
        // $drawObject[m]
        if ((tokAt(i + 2) == Token.leftsquare || isFrame)) {
          Point3f pto = center = centerParameter(i);
          i = iToken;
          propertyName = "coord";
          propertyValue = pto;
          havePoints = true;
          break;
View Full Code Here

        sbCommand.append(" pmesh");
        continue;
      case Token.within:
        ptWithin = i;
        float distance;
        Point3f ptc = null;
        bs = null;
        boolean havePt = false;
        if (tokAt(i + 1) == Token.expressionBegin) {
          // within ( x.x , .... )
          distance = floatParameter(i + 3);
          if (isPoint3f(i + 4)) {
            ptc = centerParameter(i + 4);
            havePt = true;
            iToken = iToken + 2;
          } else if (isPoint3f(i + 5)) {
            ptc = centerParameter(i + 5);
            havePt = true;
            iToken = iToken + 2;
          } else {
            bs = atomExpression(statement, i + 5, statementLength, true, false,
                false, true);
            if (bs == null)
              error(ERROR_invalidArgument);
          }
        } else {
          distance = floatParameter(++i);
          ptc = centerParameter(++i);
        }
        i = iToken;
        if (fullCommand.indexOf("# WITHIN=") >= 0)
          bs = Escape.unescapeBitset(extractCommandOption("# WITHIN"));
        else if (!havePt)
          bs = (expressionResult instanceof BitSet ? (BitSet) expressionResult
              : null);
        if (!isSyntaxCheck) {
          if (bs != null)
            bs.and(viewer.getModelUndeletedAtomsBitSet(modelIndex));
          if (ptc == null)
            ptc = viewer.getAtomSetCenter(bs);

          getWithinDistanceVector(propertyList, distance, ptc, bs);
          sbCommand.append(" within ").append(distance).append(" ").append(
              bs == null ? Escape.escape(ptc) : Escape.escape(bs));
        }
        continue;
      case Token.isosurfacepropertysmoothing:
        smoothing = (getToken(++i).tok == Token.on ? Boolean.TRUE
            : theTok == Token.off ? Boolean.FALSE : null);
        if (smoothing == null)
          error(ERROR_invalidArgument);
        continue;
      case Token.property:
      case Token.variable:
        if (modelIndex < 0)
          error(ERROR_multipleModelsDisplayedNotOK, "ISOSURFACE "
              + theToken.value);
        //if (isCavity)
          //error(ERROR_invalidArgument);
        boolean isVariable = (theTok == Token.variable);
        if (dataUse == null) { // not mlp or mep
          if (!surfaceObjectSeen && !planeSeen) {
            surfaceObjectSeen = true;
            addShapeProperty(propertyList, "sasurface", new Float(0));
            sbCommand.append(" vdw");
          }
          propertyName = "property";
          if (smoothing == null)
            smoothing = viewer.getIsosurfacePropertySmoothing() ? Boolean.TRUE
                : Boolean.FALSE;
          addShapeProperty(propertyList, "propertySmoothing", smoothing);
          sbCommand.append(" isosurfacePropertySmoothing " + smoothing);
          if (viewer.isRangeSelected())
            addShapeProperty(propertyList, "rangeSelected", Boolean.TRUE);
        } else {
          propertyName = dataUse;
        }
        str = parameterAsString(i);
        sbCommand.append(" ").append(str);

        if (str.toLowerCase().indexOf("property_") == 0) {
          data = new float[viewer.getAtomCount()];
          if (isSyntaxCheck)
            continue;
          data = viewer.getDataFloat(str);
          if (data == null)
            error(ERROR_invalidArgument);
          addShapeProperty(propertyList, propertyName, data);
          continue;
        }

        int atomCount = viewer.getAtomCount();
        data = new float[atomCount];

        if (isVariable) {
          String vname = parameterAsString(++i);
          if (vname.length() == 0) {
            data = floatParameterSet(i, atomCount, atomCount);
          } else {
            data = new float[atomCount];
            if (!isSyntaxCheck)
              Parser.parseStringInfestedFloatArray(""
                  + getParameter(vname, Token.string), null, data);
          }
          if (!isSyntaxCheck)
            sbCommand.append(" \"\" ").append(Escape.escape(data));
        } else {
          int tokProperty = getToken(++i).tok;
          if (!isSyntaxCheck) {
            sbCommand.append(" " + theToken.value);
            Atom[] atoms = viewer.getModelSet().atoms;
            viewer.autoCalculate(tokProperty);
            for (int iAtom = atomCount; --iAtom >= 0;)
              data[iAtom] = Atom.atomPropertyFloat(viewer, atoms[iAtom],
                  tokProperty);
          }
          if (tokProperty == Token.color)
            colorScheme = "colorRGB";
          if (tokAt(i + 1) == Token.within) {
            float d = floatParameter(i = i + 2);
            sbCommand.append(" within " + d);
            addShapeProperty(propertyList, "propertyDistanceMax", Float.valueOf(d));
          }
        }
        propertyValue = data;
        break;
      case Token.model:
        if (surfaceObjectSeen)
          error(ERROR_invalidArgument);
        modelIndex = modelNumberParameter(++i);
        sbCommand.append(" model " + modelIndex);
        if (modelIndex < 0) {
          propertyName = "fixed";
          propertyValue = Boolean.TRUE;
          break;
        }
        propertyName = "modelIndex";
        propertyValue = new Integer(modelIndex);
        break;
      case Token.select:
        propertyName = "select";
        BitSet bs1 = atomExpression(++i);
        propertyValue = bs1;
        i = iToken;
        if (surfaceObjectSeen || isMapped) {
          sbCommand.append(" select " + Escape.escape(propertyValue));
        } else {
          bsSelect = (BitSet) propertyValue;
          if (modelIndex < 0 && bsSelect.nextSetBit(0) >= 0)
            modelIndex = viewer.getAtomModelIndex(bsSelect.nextSetBit(0));
        }
        break;
      case Token.set:
        thisSetNumber = intParameter(++i);
        sbCommand.append(" set " + thisSetNumber);
        break;
      case Token.offset:
        propertyName = "offset";
        propertyValue = centerParameter(++i);
        i = iToken;
        sbCommand.append(" offset " + Escape.escape((Point3f) propertyValue));
        break;
      case Token.center:
        propertyName = "center";
        propertyValue = centerParameter(++i);
        sbCommand.append(" center " + Escape.escape((Point3f) propertyValue));
        i = iToken;
        break;
      case Token.sign:
      case Token.color:
        int color;
        idSeen = true;
        sbCommand.append(" " + theToken.value);
        boolean isSign = (theTok == Token.sign);
        if (isSign) {
          addShapeProperty(propertyList, "sign", Boolean.TRUE);
        } else {
          if (tokAt(i + 1) == Token.density) {
            i++;
            propertyName = "colorDensity";
            sbCommand.append(" density");
            break;
          }
          /*
           * "color" now is just used as an equivalent to "sign" and as an
           * introduction to "absolute" any other use is superfluous; it has
           * been replaced with MAP for indicating "use the current surface"
           * because the term COLOR is too general.
           */

          if (getToken(i + 1).tok == Token.string) {
            colorScheme = parameterAsString(++i);
            sbCommand.append(" ").append(Escape.escape(colorScheme));
            if (colorScheme.indexOf(" ") > 0) {
              discreteColixes = Graphics3D.getColixArray(colorScheme);
              if (discreteColixes == null)
                error(ERROR_badRGBColor);
            }
          } else if (theTok == Token.mesh) {
            i++;
            sbCommand.append(" mesh");
            color = getArgbParam(++i);
            addShapeProperty(propertyList, "meshcolor", new Integer(color));
            sbCommand.append(" ").append(Escape.escapeColor(color));
            i = iToken;
            continue;
          }
          if ((theTok = tokAt(i + 1)) == Token.translucent
              || theTok == Token.opaque) {
            translucency = setColorOptions(sbCommand, i + 1,
                JmolConstants.SHAPE_ISOSURFACE, -2);
            i = iToken;
            continue;
          }
          switch (tokAt(i + 1)) {
          case Token.absolute:
          case Token.range:
            getToken(++i);
            sbCommand.append(" range");
            addShapeProperty(propertyList, "rangeAll", null);
            if (tokAt(i + 1) == Token.all) {
              i++;
              sbCommand.append(" all");
              continue;
            }
            float min = floatParameter(++i);
            float max = floatParameter(++i);
            addShapeProperty(propertyList, "red", new Float(min));
            addShapeProperty(propertyList, "blue", new Float(max));
            sbCommand.append(" ").append(min).append(" ").append(max);
            continue;
          }
        }
        if (isColorParam(i + 1)) {
          color = getArgbParam(++i);
          addShapeProperty(propertyList, "colorRGB", new Integer(color));
          sbCommand.append(" ").append(Escape.escapeColor(color));
          i = iToken;
          idSeen = true;
          if (isColorParam(i + 1)) {
            color = getArgbParam(++i);
            i = iToken;
            addShapeProperty(propertyList, "colorRGB", new Integer(color));
            sbCommand.append(" ").append(Escape.escapeColor(color));
          } else if (isSign) {
            error(ERROR_invalidParameterOrder);
          }
        } else if (!isSign && discreteColixes == null) {
          error(ERROR_invalidParameterOrder);
        }
        continue;
      case Token.file:
        continue;
      case Token.ionic:
      case Token.vanderwaals:
        sbCommand.append(" ").append(theToken.value);
        RadiusData rd = encodeRadiusParameter(i, false);
        sbCommand.append(" ").append(rd);
        if (Float.isNaN(rd.value))
          rd.value = 100;
        propertyValue = rd;
        propertyName = "radius";
        haveRadius = true;
        if (isMapped)
          surfaceObjectSeen = false;
        i = iToken;
        break;
      case Token.plane:
        // plane {X, Y, Z, W}
        planeSeen = true;
        propertyName = "plane";
        propertyValue = planeParameter(++i);
        i = iToken;
        sbCommand.append(" plane ").append(
            Escape.escape((Point4f) propertyValue));
        break;
      case Token.scale3d:
        propertyName = "scale3d";
        propertyValue = new Float(floatParameter(++i));
        sbCommand.append(" scale3d ").append(propertyValue);
        break;
      case Token.scale:
        propertyName = "scale";
        propertyValue = new Float(floatParameter(++i));
        sbCommand.append(" scale ").append(propertyValue);
        break;
      case Token.all:
        if (idSeen)
          error(ERROR_invalidArgument);
        propertyName = "thisID";
        break;
      case Token.ellipsoid:
        // ellipsoid {xc yc zc f} where a = b and f = a/c
        // OR ellipsoid {u11 u22 u33 u12 u13 u23}
        surfaceObjectSeen = true;
        ++i;
        try {
          propertyValue = getPoint4f(i);
          propertyName = "ellipsoid";
          i = iToken;
          sbCommand.append(" ellipsoid ").append(
              Escape.escape((Point4f) propertyValue));
          break;
        } catch (ScriptException e) {
        }
        try {
          propertyName = "ellipsoid";
          propertyValue = floatParameterSet(i, 6, 6);
          i = iToken;
          sbCommand.append(" ellipsoid ").append(
              Escape.escape((float[]) propertyValue));
          break;
        } catch (ScriptException e) {
        }
        bs = atomExpression(i);
        sbCommand.append(" ellipsoid ").append(Escape.escape(bs));
        int iAtom = bs.nextSetBit(0);
        Atom[] atoms = viewer.getModelSet().atoms;
        if (iAtom >= 0)
          propertyValue = atoms[iAtom].getEllipsoid();
        if (propertyValue == null)
          return;
        i = iToken;
        propertyName = "ellipsoid";
        if (!isSyntaxCheck)
          addShapeProperty(propertyList, "center", viewer.getAtomPoint3f(iAtom));
        break;
      case Token.hkl:
        // miller indices hkl
        planeSeen = true;
        propertyName = "plane";
        propertyValue = hklParameter(++i);
        i = iToken;
        sbCommand.append(" plane ").append(
            Escape.escape((Point4f) propertyValue));
        break;
      case Token.lcaocartoon:
        surfaceObjectSeen = true;
        String lcaoType = parameterAsString(++i);
        addShapeProperty(propertyList, "lcaoType", lcaoType);
        sbCommand.append(" lcaocartoon ").append(Escape.escape(lcaoType));
        switch (getToken(++i).tok) {
        case Token.bitset:
        case Token.expressionBegin:
          propertyName = "lcaoCartoon";
          bs = atomExpression(i);
          sbCommand.append(" ").append(Escape.escape(bs));
          i = iToken;
          int atomIndex = bs.nextSetBit(0);
          modelIndex = 0;
          Point3f pt;
          if (atomIndex < 0) {
            if (!isSyntaxCheck)
              error(ERROR_expressionExpected);
            pt = new Point3f();
          } else {
            modelIndex = viewer.getAtomModelIndex(atomIndex);
            pt = viewer.getAtomPoint3f(atomIndex);
          }
          addShapeProperty(propertyList, "modelIndex", new Integer(modelIndex));
          Vector3f[] axes = { new Vector3f(), new Vector3f(), new Vector3f(pt),
              new Vector3f() };
          if (!isSyntaxCheck
              && !lcaoType.equalsIgnoreCase("s")
              && viewer.getHybridizationAndAxes(atomIndex, axes[0], axes[1],
                  lcaoType) == null)
            return;
          propertyValue = axes;
          break;
        default:
          error(ERROR_expressionExpected);
        }
        break;
      case Token.mo:
        // mo 1-based-index
        int moNumber = Integer.MAX_VALUE;
        int offset = Integer.MAX_VALUE;
        switch (tokAt(++i)) {
        case Token.nada:
          error(ERROR_badArgumentCount);
        case Token.homo:
        case Token.lumo:
          offset = moOffset(i);
          moNumber = 0;
          i = iToken;
          sbCommand.append(" mo HOMO ");
          if (offset > 0)
            sbCommand.append("+");
          if (offset != 0)
            sbCommand.append(offset);
          break;
        case Token.integer:
          moNumber = intParameter(i);
          sbCommand.append(" mo ").append(moNumber);
          break;
        }
        setMoData(propertyList, moNumber, offset, modelIndex, null);
        surfaceObjectSeen = true;
        continue;
      case Token.mep:
      case Token.mlp:
        boolean isMep = (theTok == Token.mep);
        propertyName = (isMep ? "mep" : "mlp");
        sbCommand.append(" " + propertyName);
        String fname = null;
        int calcType = -1;
        surfaceObjectSeen = true;
        if (tokAt(i + 1) == Token.integer) {
          calcType = intParameter(++i);
          sbCommand.append(" " + calcType);
          addShapeProperty(propertyList, "mepCalcType", new Integer(calcType));
        }
        if (tokAt(i + 1) == Token.string) {
          fname = stringParameter(++i);
          sbCommand.append(" /*file*/" + Escape.escape(fname));
        } else if (tokAt(i + 1) == Token.property) {
          dataUse = propertyName;
          continue;
        }
        if (!isSyntaxCheck)
          try {
            data = (fname == null && isMep ? viewer.getPartialCharges()
                : viewer.getAtomicPotentials(isMep, bsSelect, bsIgnore, fname));
          } catch (Exception e) {
            // ignore
          }
        if (!isSyntaxCheck && data == null)
          error(ERROR_noPartialCharges);
        propertyValue = data;
        break;
      case Token.volume:
        doCalcVolume = !isSyntaxCheck;
        sbCommand.append(" volume");
        break;
      case Token.id:
        setShapeId(iShape, ++i, idSeen);
        isWild = (getShapeProperty(iShape, "ID") == null);
        i = iToken;
        break;
      case Token.colorscheme:
        // either order NOT OK -- documented for TRANSLUCENT "rwb"
        if (tokAt(i + 1) == Token.translucent) {
          isColorSchemeTranslucent = true;
          i++;
        }
        colorScheme = parameterAsString(++i);
        sbCommand.append(" colorScheme");
        if (isColorSchemeTranslucent)
          sbCommand.append(" translucent");
        sbCommand.append(" ").append(Escape.escape(colorScheme));
        break;
      case Token.addhydrogens:
        propertyName = "addHydrogens";
        propertyValue = Boolean.TRUE;
        sbCommand.append(" addHydrogens");
        break;
      case Token.angstroms:
        propertyName = "angstroms";
        sbCommand.append(" angstroms");
        break;
      case Token.anisotropy:
        propertyName = "anisotropy";
        propertyValue = getPoint3f(++i, false);
        sbCommand.append(" anisotropy").append(
            Escape.escape((Point3f) propertyValue));
        i = iToken;
        break;
      case Token.area:
        doCalcArea = !isSyntaxCheck;
        sbCommand.append(" area");
        break;
      case Token.atomicorbital:
      case Token.orbital:
        surfaceObjectSeen = true;
        nlmZ[0] = intParameter(++i);
        nlmZ[1] = intParameter(++i);
        nlmZ[2] = intParameter(++i);
        nlmZ[3] = (isFloatParameter(i + 1) ? floatParameter(++i) : 6f);
        sbCommand.append(" atomicOrbital ").append((int) nlmZ[0]).append(" ")
            .append((int) nlmZ[1]).append(" ").append((int) nlmZ[2])
            .append(" ").append(nlmZ[3]);
        propertyName = "hydrogenOrbital";
        propertyValue = nlmZ;
        break;
      case Token.binary:
        sbCommand.append(" binary");
        // for PMESH, specifically
        // ignore for now
        continue;
      case Token.blockdata:
        sbCommand.append(" blockData");
        propertyName = "blockData";
        propertyValue = Boolean.TRUE;
        break;
      case Token.cap:
      case Token.slab:
        propertyName = (String) theToken.value;
        propertyValue = getCapSlabObject(sbCommand, i);
        i = iToken;
        break;
      case Token.cavity:
        if (!isIsosurface)
          error(ERROR_invalidArgument);
        isCavity = true;
        if (isSyntaxCheck)
          continue;
        float cavityRadius = (isFloatParameter(i + 1) ? floatParameter(++i)
            : 1.2f);
        float envelopeRadius = (isFloatParameter(i + 1) ? floatParameter(++i)
            : 10f);
        if (envelopeRadius > 10f)
          integerOutOfRange(0, 10);
        sbCommand.append(" cavity ").append(cavityRadius).append(" ").append(
            envelopeRadius);
        addShapeProperty(propertyList, "envelopeRadius", new Float(
            envelopeRadius));
        addShapeProperty(propertyList, "cavityRadius", new Float(cavityRadius));
        propertyName = "cavity";
        break;
      case Token.contour:
      case Token.contours:
        propertyName = "contour";
        sbCommand.append(" contour");
        switch (tokAt(i + 1)) {
        case Token.discrete:
          propertyValue = floatParameterSet(i + 2, 1, Integer.MAX_VALUE);
          sbCommand.append(" discrete ").append(Escape.escape(propertyValue));
          i = iToken;
          break;
        case Token.increment:
          Point3f pt = getPoint3f(i + 2, false);
          if (pt.z <= 0 || pt.y < pt.x)
            error(ERROR_invalidArgument); // from to step
          if (pt.z == (int) pt.z && pt.z > (pt.y - pt.x))
            pt.z = (pt.y - pt.x) / pt.z;
          propertyValue = pt;
          i = iToken;
          sbCommand.append(" increment ").append(Escape.escape(pt));
          break;
        default:
          propertyValue = new Integer(
              tokAt(i + 1) == Token.integer ? intParameter(++i) : 0);
          sbCommand.append(" ").append(propertyValue);
        }
        break;
      case Token.decimal:
      case Token.integer:
      case Token.plus:
      case Token.cutoff:
        sbCommand.append(" cutoff ");
        if (theTok == Token.cutoff)
          i++;
        if (tokAt(i) == Token.plus) {
          propertyName = "cutoffPositive";
          propertyValue = new Float(cutoff = floatParameter(++i));
          sbCommand.append("+").append(propertyValue);
        } else {
          propertyName = "cutoff";
          propertyValue = new Float(cutoff = floatParameter(i));
          sbCommand.append(propertyValue);
        }
        break;
      case Token.downsample:
        propertyName = "downsample";
        propertyValue = new Integer(intParameter(++i));
        sbCommand.append(" downsample ").append(propertyValue);
        break;
      case Token.eccentricity:
        propertyName = "eccentricity";
        propertyValue = getPoint4f(++i);
        sbCommand.append(" eccentricity ").append(
            Escape.escape((Point4f) propertyValue));
        i = iToken;
        break;
      case Token.ed:
        sbCommand.append(" ed");
        // electron density - never documented
        setMoData(propertyList, -1, 0, modelIndex, null);
        surfaceObjectSeen = true;
        continue;
      case Token.debug:
      case Token.nodebug:
        sbCommand.append(" ").append(theToken.value);
        propertyName = "debug";
        propertyValue = (theTok == Token.debug ? Boolean.TRUE : Boolean.FALSE);
        break;
      case Token.fixed:
        sbCommand.append(" fixed");
        propertyName = "fixed";
        propertyValue = Boolean.TRUE;
        break;
      case Token.fullplane:
        sbCommand.append(" fullPlane");
        propertyName = "fullPlane";
        propertyValue = Boolean.TRUE;
        break;
      case Token.functionxy:
      case Token.functionxyz:
        boolean isFxyz = (theTok == Token.functionxyz);
        propertyName = "" + theToken.value;
        // isosurface functionXY "functionName"|"data2d_xxxxx"
        // isosurface functionXYZ "functionName"|"data3d_xxxxx"
        // {origin} {ni ix iy iz} {nj jx jy jz} {nk kx ky kz}
        List vxy = new ArrayList();
        i++;
        String name = parameterAsString(i++);
        // override of function or data name when saved as a state
        String dName = extractCommandOption("# DATA" + (isFxy ? "2" : ""));
        if (dName == null)
          dName = "inline";
        else
          name = dName;
        sbCommand.append(" ").append(propertyName).append(" inline");
        boolean isXYZ = (name.indexOf("data2d_") == 0);
        boolean isXYZV = (name.indexOf("data3d_") == 0);
        boolean isInline = name.equals("inline");
        vxy.add(name); // (0) = name
        Point3f pt3 = getPoint3f(i, false);
        sbCommand.append(" ").append(Escape.escape(pt3));
        vxy.add(pt3); // (1) = {origin}
        Point4f pt4;
        ptX = ++iToken;
        vxy.add(pt4 = getPoint4f(ptX)); // (2) = {ni ix iy iz}
View Full Code Here

  private void getWithinDistanceVector(List propertyList, float distance,
                                       Point3f ptc, BitSet bs) {
    List v = new ArrayList();
    Point3f[] pts = new Point3f[2];
    if (bs == null) {
      Point3f pt1 = new Point3f(distance, distance, distance);
      Point3f pt0 = new Point3f(ptc);
      pt0.sub(pt1);
      pt1.add(ptc);
      pts[0] = pt0;
      pts[1] = pt1;
      v.add(ptc);
    } else {
View Full Code Here

TOP

Related Classes of javax.vecmath.Point3f

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.