public static Rectangle2D createRectangle(final Size2D dimensions,
                                              final double anchorX,
                                              final double anchorY,
                                              final RectangleAnchor anchor) {
        Rectangle2D result = null;
        final double w = dimensions.getWidth();
        final double h = dimensions.getHeight();
        if (anchor == RectangleAnchor.CENTER) {
            result = new Rectangle2D.Double(
                anchorX - w / 2.0, anchorY - h / 2.0, w, h
            );
        }
        else if (anchor == RectangleAnchor.TOP) {
            result = new Rectangle2D.Double(
                anchorX - w / 2.0, anchorY - h / 2.0, w, h
            );
        }
        else if (anchor == RectangleAnchor.BOTTOM) {
            result = new Rectangle2D.Double(
                anchorX - w / 2.0, anchorY - h / 2.0, w, h
            );
        }
        else if (anchor == RectangleAnchor.LEFT) {
            result = new Rectangle2D.Double(
                anchorX, anchorY - h / 2.0, w, h
            );
        }
        else if (anchor == RectangleAnchor.RIGHT) {
            result = new Rectangle2D.Double(
                anchorX - w, anchorY - h / 2.0, w, h
            );
        }
        else if (anchor == RectangleAnchor.TOP_LEFT) {
            result = new Rectangle2D.Double(
                anchorX - w / 2.0, anchorY - h / 2.0, w, h
            );
        }
        else if (anchor == RectangleAnchor.TOP_RIGHT) {
            result = new Rectangle2D.Double(
                anchorX - w / 2.0, anchorY - h / 2.0, w, h
            );
        }
        else if (anchor == RectangleAnchor.BOTTOM_LEFT) {
            result = new Rectangle2D.Double(
                anchorX - w / 2.0, anchorY - h / 2.0, w, h
            );
        }
        else if (anchor == RectangleAnchor.BOTTOM_RIGHT) {
            result = new Rectangle2D.Double(
                anchorX - w / 2.0, anchorY - h / 2.0, w, h
            );
        }
        return result;
    }