Package javax.vecmath

Examples of javax.vecmath.Vector2d.sub()


        IAtomContainer undoRedoContainer = chemModel.getBuilder()
            .newInstance(IAtomContainer.class);
        undoRedoContainer.addAtom(bond.getAtom(0));
        undoRedoContainer.addAtom(bond.getAtom(1));
        Vector2d end = new Vector2d();
        end.sub(point, bond.getAtom(0).getPoint2d());
        IUndoRedoable undoredo = getUndoRedoFactory().getMoveAtomEdit(
            undoRedoContainer, end, "Move atom");
        getUndoRedoHandler().postEdit(undoredo);
      }
      moveToWithoutUndo(bond, point);
View Full Code Here


    double bondLength = GeometryTools.getBondLengthAverage(sourceContainer);
    Point2d conAtomsCenter = getConnectedAtomsCenter(sharedAtoms, chemModel);

    Point2d sharedAtomsCenter = atom.getPoint2d();
    Vector2d ringCenterVector = new Vector2d(sharedAtomsCenter);
    ringCenterVector.sub(conAtomsCenter);

    if ((ringCenterVector.x == 0 && ringCenterVector.y == 0)) {
      // Rare bug case:
      // the spiro ring can not be attached, it will lead
      // to NaN values deeper down and serious picture distortion.
View Full Code Here

      Point2d conAtomsCenter = getConnectedAtomsCenter(sharedAtoms,
          chemModel);

      Point2d sharedAtomsCenter = atom.getPoint2d();
      Vector2d ringCenterVector = new Vector2d(sharedAtomsCenter);
      ringCenterVector.sub(conAtomsCenter);

      if ((ringCenterVector.x == 0 && ringCenterVector.y == 0)) {
        return chemModel.getBuilder().newInstance(IRing.class);
      } else {
        ringPlacer.placeSpiroRing(newRing, sharedAtoms,
View Full Code Here

    // calculate two points that are perpendicular to the highlighted bond
    // and have a certain distance from the bond center
    Point2d firstPoint = firstAtom.getPoint2d();
    Point2d secondPoint = secondAtom.getPoint2d();
    Vector2d diff = new Vector2d(secondPoint);
    diff.sub(firstPoint);
    double bondLength = firstPoint.distance(secondPoint);
    double angle = GeometryTools.getAngle(diff.x, diff.y);
    Point2d newPoint1 = new Point2d( // FIXME: what is this point??
        (Math.cos(angle + (Math.PI / 2)) * bondLength / 4)
            + sharedAtomsCenter.x, (Math.sin(angle + (Math.PI / 2))
View Full Code Here

    Point2d conAtomsCenter = GeometryTools.get2DCenter(connectedAtoms);
    double distance1 = newPoint1.distance(conAtomsCenter);
    double distance2 = newPoint2.distance(conAtomsCenter);
    Vector2d ringCenterVector = new Vector2d(sharedAtomsCenter);
    if (distance1 < distance2) {
      ringCenterVector.sub(newPoint1);
    } else { // distance2 <= distance1
      ringCenterVector.sub(newPoint2);
    }

    // construct a new Ring that contains the highlighted bond an its two
View Full Code Here

    double distance2 = newPoint2.distance(conAtomsCenter);
    Vector2d ringCenterVector = new Vector2d(sharedAtomsCenter);
    if (distance1 < distance2) {
      ringCenterVector.sub(newPoint1);
    } else { // distance2 <= distance1
      ringCenterVector.sub(newPoint2);
    }

    // construct a new Ring that contains the highlighted bond an its two
    // atoms
    IRing newRing = createAttachRing(sharedAtoms, size, "C", phantom);
View Full Code Here

    // calculate two points that are perpendicular to the highlighted bond
    // and have a certain distance from the bond center
    Point2d firstPoint = firstAtom.getPoint2d();
    Point2d secondPoint = secondAtom.getPoint2d();
    Vector2d diff = new Vector2d(secondPoint);
    diff.sub(firstPoint);
    double bondLength = firstPoint.distance(secondPoint);
    double angle = GeometryTools.getAngle(diff.x, diff.y);
    Point2d newPoint1 = new Point2d( // FIXME: what is this point??
        (Math.cos(angle + (Math.PI / 2)) * bondLength / 4)
            + sharedAtomsCenter.x, (Math.sin(angle + (Math.PI / 2))
View Full Code Here

    Point2d conAtomsCenter = GeometryTools.get2DCenter(connectedAtoms);
    double distance1 = newPoint1.distance(conAtomsCenter);
    double distance2 = newPoint2.distance(conAtomsCenter);
    Vector2d ringCenterVector = new Vector2d(sharedAtomsCenter);
    if (distance1 < distance2) {
      ringCenterVector.sub(newPoint1);
    } else { // distance2 <= distance1
      ringCenterVector.sub(newPoint2);
    }

    // construct a new Ring that contains the highlighted bond an its two
View Full Code Here

    double distance2 = newPoint2.distance(conAtomsCenter);
    Vector2d ringCenterVector = new Vector2d(sharedAtomsCenter);
    if (distance1 < distance2) {
      ringCenterVector.sub(newPoint1);
    } else { // distance2 <= distance1
      ringCenterVector.sub(newPoint2);
    }

    // construct a new Ring that contains the highlighted bond an its two
    // atoms
    IRing newRing = createAttachRing(sharedAtoms, 6, "C", phantom);
View Full Code Here

          .getSelection().getConnectedAtomContainer();
      if (movedAtomContainer != null) {
        IAtom atomA = (IAtom) it.next();
        IAtom atomB = mergeMap.get(atomA);
        Vector2d shift = new Vector2d();
        shift.sub(atomB.getPoint2d(), atomA.getPoint2d());

        for (IAtom shiftAtom : movedAtomContainer.atoms()) {
          shiftAtom.getPoint2d().add(shift);
        }
      }
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.