public void updateTriangle(Shape shape, double x2, double y2) {

		Triangle triangle = (Triangle) shape;

		AffineTransform transform = new AffineTransform();
		transform
				.concatenate(new AffineTransform(new double[] {
						Math.cos(shape.getRotation()),
						-Math.sin(shape.getRotation()),
						Math.sin(shape.getRotation()),
						Math.cos(shape.getRotation()) }));
		Point2D point = new Point2D.Double();
		transform.transform(new Point2D.Double(x2, y2), point);
		x2 = point.getX();
		y2 = point.getY();

		switch (triangle.getCornerSelected()) {

		case 0:
			triangle.setX1(x2);
			triangle.setY1(y2);
			break;

		case 1:
			triangle.setX2(x2);
			triangle.setY2(y2);
			break;
		case 2:
			triangle.setX3(x2);
			triangle.setY3(y2);
			break;
		}

		resetTriangleCenter(triangle);
	}