Package javax.vecmath

Examples of javax.vecmath.Vector2d.sub()


        zoom(z);
        Point2d newScreenCoords =
            renderer.toScreenCoordinates( worldCoord.x, worldCoord.y );
       
        Vector2d v= new Vector2d();
        v.sub( screenCoord, newScreenCoords );
        renderer.shiftDrawCenter( v.x, v.y );
    }
   
    private void zoom(double zoomFactor) {
        JChemPaintRendererModel model = chemModelRelay.getRenderer().getRenderer2DModel();
View Full Code Here


      if (start2DCenter != null) {
            Vector2d end = new Vector2d();

            // take 2d center of end point to ensure correct positional undo
            Point2d end2DCenter = GeometryTools.get2DCenter(atomsToMove);
            end.sub(end2DCenter, start2DCenter);

            Map<IAtom, IAtom> mergeMap = calculateMerge(atomsToMove);
            JChemPaintRendererModel model = chemModelRelay.getRenderer().getRenderer2DModel();
            model.getMerge().clear();
            model.getMerge().putAll(mergeMap);
View Full Code Here

                try {
          chemModelRelay.mergeMolecules(end);
        } catch (RuntimeException e) {
          //move things back, merge is not allowed
                Vector2d d = new Vector2d();
                d.sub(start2DCenter,end2DCenter);
          chemModelRelay.moveBy(atomsToMove, d, null);
                chemModelRelay.updateView();
        }
            }else {
                chemModelRelay.moveBy(atomsToMove, null, end);
View Full Code Here

      end2DCenter = worldCoordTo;
        Point2d atomCoord = new Point2d();
        atomCoord.add(worldCoordTo, offset);

        Vector2d d = new Vector2d();
        d.sub(worldCoordTo, worldCoordFrom);

        chemModelRelay.moveBy(atomsToMove, d, null);
        chemModelRelay.updateView();
    }
View Full Code Here

    }

  public static Point2d roundAngle(Point2d s,Point2d d, double bondLength) {

        Vector2d v = new Vector2d();
        v.sub( d, s );
        double rad = Math.atan2(v.y,v.x);
        double deg = Math.toDegrees( rad );
        deg = Math.round( deg/15)*15;
        rad = Math.toRadians( deg );
        v.x = bondLength*Math.cos( rad );
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.