Package javax.vecmath

Examples of javax.vecmath.Vector3f.sub()


    doAnimate = (nSeconds != 0);
    float endDegrees = Float.NaN;
    Vector3f translation = null;
    if (doTranslate) {
      translation = new Vector3f(centerAndPoints[1][0]);
      translation.sub(centerAndPoints[0][0]);
      endDegrees = 0;
    }
    if (doRotate) {
      if (q == null)
        evalError("option not implemented", null);
View Full Code Here


      switch(iType) {
      case 3:
        break;
      case 1: // polymer
        v2 = new Vector3f(pts[2]);
        v2.sub(pts[0]);
        v2.scale(1000f);
        // fall through
      case 2: // slab
        // "a b c" is really "z y x"
        v1 = new Vector3f(pts[1]);
View Full Code Here

         a'+---------a
                r
    */
   
    Vector3f vab = new Vector3f();
    vab.sub(b, a);
    /*
     * testing here to see if directing the normal makes any difference -- oddly
     * enough, it does not. When n = -n and theta = -theta vab.n is reversed,
     * and that magnitude is multiplied by n in generating the A'-B' vector.
     *
 
View Full Code Here

  public static void calcXYNormalToLine(Point3f pointA, Point3f pointB,
                                   Vector3f vNormNorm) {
    // vector in xy plane perpendicular to a line between two points RMH
    Vector3f axis = new Vector3f(pointA);
    axis.sub(pointB);
    vNormNorm.cross(axis, JmolConstants.axisY);
    vNormNorm.normalize();
    if (Float.isNaN(vNormNorm.x))
      vNormNorm.set(1, 0, 0);
  }
View Full Code Here

    Point3f[] cptsB = getCenterAndPoints(ptsB);
    float[] retStddev = new float[2];
    Quaternion q = calculateQuaternionRotation(new Point3f[][] { cptsA,
        cptsB }, retStddev, false);
    Vector3f v = new Vector3f(cptsB[0]);
    v.sub(cptsA[0]);
    m.set(q.getMatrix(), v, 1);
    if (centerA != null)
      centerA.set(cptsA[0]);
    return retStddev[1];
  }
View Full Code Here

    if (ptP == null || ptA == null || ptB == null)
      return null;
    Vector3f vA = new Vector3f();
    Vector3f vB = new Vector3f();
    vA.sub(ptA, ptP);
    vB.sub(ptB, ptP);
    return Quaternion.getQuaternionFrame(vA, vB, null, false);
  }
 
 
  Point3f getQuaternionFrameCenter(char qType) {
View Full Code Here

    Vector3f v = new Vector3f();
    for (int i = 0; i < 8; i++)
      center.add(pts[i]);
    center.scale(1/8f);
    for (int i = 0; i < 8; i++) {
      v.sub(pts[i], center);
      v.scale(scale);
      pts[i].add(center, v);
    }
  }
View Full Code Here

      }
      if (vNot.size() == 0)
        return;
      pt = Measure.getCenterAndPoints(vNot)[0];
      Vector3f v = new Vector3f(thisAtom);
      v.sub(pt);
      Quaternion q = new Quaternion(v, 180);
      rotateAtoms(null, q.getMatrix(), bsAtoms, thisAtom, true);
    }
  }
View Full Code Here

      } else if (!wasH && atomicNumber == 1) {
        dx = 1.0f;
      }
    if (dx != 0) {
      Vector3f v = new Vector3f(atom);
      v.sub(atoms[atom.getBondedAtomIndex(0)]);
      float d = v.length();
      v.normalize();
      v.scale(dx - d);
      setAtomCoordRelative(atomIndex, v.x, v.y, v.z);
    }
View Full Code Here

    for (int i = 0; i < myAtomCount; i++)
      setBoundingBox(atomXyz[i], atomRadius[i]);
    if (!Float.isNaN(params.scale)) {
      Vector3f v = new Vector3f(xyzMax);
      v.sub(xyzMin);
      v.scale(0.5f);
      xyzMin.add(v);
      v.scale(params.scale);
      xyzMax.set(xyzMin);
      xyzMax.add(v);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.