Shape (Line2D line, Point2D intersectionPoint) { final double deltaY = line.getP2().getY() - line.getP1().getY(); final double length = Math.sqrt(Math.pow(deltaY, 2) + Math.pow(line.getP2().getX() - line.getP1().getX(), 2)); double theta = Math.asin(deltaY / length); if (line.getP1().getX() > line.getP2().getX()) { theta = Math.PI - theta; } AffineTransform rotate = AffineTransform.getRotateInstance(theta, myArrowSize, myArrowSize / 2); Shape polygon = rotate.createTransformedShape(myArrowPolygon); AffineTransform move = AffineTransform.getTranslateInstance(intersectionPoint.getX() - myArrowSize, intersectionPoint.getY() - myArrowSize /2); polygon = move.createTransformedShape(polygon); return polygon; }