public void rotateTo(int x, int y, int handle) {

		if (savedCenter == null)
			savedCenter = getCenterOfMass2D();

		double dx = x - savedCenter.getX();
		double dy = y - savedCenter.getY();
		double distance = Math.hypot(dx, dy);
		if (distance < 1.0)
			return;

		double sintheta0 = 0, costheta0 = 0;
		boolean b = savedHandleX != 0 && savedHandleY != 0;
		if (b) {
			costheta0 = savedHandleX - savedCenter.getX();
			sintheta0 = savedHandleY - savedCenter.getY();
			double r = Math.hypot(costheta0, sintheta0);
			costheta0 /= r;
			sintheta0 /= r;
		}

		double costheta = dx / distance;
		double sintheta = dy / distance;
		double x2 = savedCenter.getX() + 60.0 * costheta;
		double y2 = savedCenter.getY() + 60.0 * sintheta;
		rotateRect.setRect(x2 - 4, y2 - 4, 8, 8);
		rotateCrossLine[0].setLine(savedCenter.getX(), savedCenter.getY(), x2, y2);
		rotateCrossLine[1].setLine(x2 - 10.0 * sintheta, y2 + 10.0 * costheta, x2 + 10.0 * sintheta, y2 - 10.0
				* costheta);

		if (b) {
			// delta = theta - theta0
			dx = costheta * costheta0 + sintheta * sintheta0;
			dy = sintheta * costheta0 - costheta * sintheta0;
			costheta = dx;
			sintheta = dy;
		}

		Point2D oldPoint;
		double oldX, oldY;
		synchronized (atoms) {
			for (Atom at : atoms) {
				if (savedCRD == null || savedCRD.isEmpty()) {
					oldX = at.rx;
					oldY = at.ry;
				}
				else {
					oldPoint = savedCRD.get(at);
					oldX = oldPoint.getX();
					oldY = oldPoint.getY();
				}
				dx = oldX - savedCenter.getX();
				dy = oldY - savedCenter.getY();
				distance = Math.hypot(dx, dy);
				if (distance > 0.1) {
					costheta0 = dx / distance;
					sintheta0 = dy / distance;
					// theta0 + delta
					at.rx = savedCenter.getX() + distance * (costheta * costheta0 - sintheta * sintheta0);
					at.ry = savedCenter.getY() + distance * (sintheta * costheta0 + costheta * sintheta0);
				}
			}
		}

	}