| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static boolean | contains(Rectangle2D
the rectangle to check rectangle, Edge2D the edge to check edge)Indicates whether the specified rectangle contains the specified edge. |
| private static double | Returns: the corrected differencethe difference to check difference, double the other difference otherDifference, double the ratio as a multiplier for the other difference ratioAsMultiplier)Returns the difference with the following properties: - it has the same sign as the specified difference - its absolute value is the minimum of the absolute values of ... |
| private static Rectangle2D | Returns: a newRectangle2D with the specified centerPoint and ratio; it has the specified
area unless this would violate the bounds; in this case it is as large as possible while
still staying within the boundsthe new rectangle's center point centerPoint, double the new rectangle's area (if possible without violating the bounds) area, double the new ratio ratio, Rectangle2D the bounds within which the new rectangle will be located bounds)Creates a new rectangle with the specified |
| private static Rectangle2D | Returns: a rectanglethe edge which will be contained in the returned rectangle edge, double if the edge's orientation is otherDimension)horizontal, this is interpreted as the
height; if the edge's orientation is vertical, this is interpreted as the
widthReturns a rectangle that has the specified edge and a height or width (depending on the edge's orientation) as
specified by |
| private static Rectangle2D | Returns: a rectanglethe horizontal edge which will be contained in the returned rectangle horizontalEdge, double the returned rectangle's height height)Returns a rectangle that has the specified horizontal edge and height. |
| private static Rectangle2D | Returns: a rectanglethe vertical edge which will be contained in the returned rectangle verticalEdge, double the returned rectangle's height width)Returns a rectangle that has the specified horizontal edge and width. |
| private static Rectangle2D | Returns: a newRectangle2D with the same center point as the original and the specified
ratio; it has the same area as the original unless this would violate the bounds; in this
case it is as large as possible while still staying within the boundsthe original rectangle original, double the new ratio ratio, Rectangle2D the bounds within which the new rectangle will be located; might be bounds)nullCreates a new rectangle with the same center point and area as the specified |
| public static Rectangle2D | Returns: a newRectangle2D with the same center point as the original and the specified
ratio; it has the same area as the originalthe original rectangle original, double the new ratio ratio)Creates a new rectangle with the same center point and area as the specified |
| public static Rectangle2D | Returns: a newRectangle2D with the same center point as the original and the specified
ratio; it has the same area as the original unless this would violate the bounds; in this
case it is as large as possible while still staying within the boundsthe original rectangle original, double the new ratio ratio, Rectangle2D the bounds within which the new rectangle will be located bounds)Creates a new rectangle with the same center point and area (if possible) as the specified |
| public static Rectangle2D | forCenterAndAreaAndRatio(Point2D
the new rectangle's center point centerPoint, double the new rectangle's area area, double the new ratio ratio)Creates a new rectangle with the specified |
| public static Rectangle2D | Returns: a newRectangle2D with the specified centerPoint and ratio; it has the specified
area unless this would violate the bounds; in this case it is as large as possible while
still staying within the boundsthe new rectangle's center point centerPoint, double the new rectangle's area (if possible without violating the bounds) area, double the new ratio ratio, Rectangle2D the bounds within which the new rectangle will be located bounds)Creates a new rectangle with the specified |
| public static Rectangle2D | Returns: a rectangle with the specified center and sizethe center point o the new rectangle centerPoint, double the width of the new rectangle width, double the height of the new rectangle height)Creates a new rectangle with the specified center and the specified width and height. |
| public static Rectangle2D | Returns: theRectangle2D which is defined by the two cornersone corner oneCorner, Point2D another corner, diagonal from the first diagonalCorner)Creates a new rectangle with the two specified corners. |
| public static Rectangle2D | Returns: theRectangle2D which is defined by the fixedCorner, the x- or y-parallel of the
diagonalCorner and the ratioone corner fixedCorner, Point2D another corner, diagonal from the first diagonalCorner, double the ratio the returned rectangle must have; must be non-negative ratio)Creates a new rectangle with the two specified corners. |
| public static Rectangle2D | Returns: a rectanglethe edge which will be contained in the returned rectangle edge, Point2D the point whose X or Y coordinate defines the other edge point)Returns a rectangle that has the specified edge and has its opposing edge on the parallel axis defined by the specified point's X or Y coordinate (depending on the edge's orientation). |
| public static Rectangle2D | Returns: a rectanglethe edge which defines the center point and orientation of one of the rectangle's edges; must be
within the specified edge, Point2D boundsthe point to which the rectangle spans if ratio and bounds allow it point, double the ratio the new rectangle must have ratio, Rectangle2D the bounds within which the new rectangle must lie bounds)Returns a rectangle that is principally defined by the specified edge and point. |
| public static Rectangle2D | Returns: theRectangle2D which is defined by the specified upper left corner and width and heightone corner upperLeft, double the new rectangle's width width, double the new rectangle's height height)Creates a new rectangle with the specified |
| public static Rectangle2D | Returns: aRectangle2D with the same minX-, minY-, maxX- and maxY-coordiantes as the specified boundsthe bounds)Bounds for which the rectangle will be createdReturns a rectangle with the same coordinates as the specified bounds. |
| public static Point2D | getCenterPoint(Rectangle2D
the rectangle)Rectangle2D whose center point will be returnedReturns the center of the specified rectangle as a point. |
| private static double | Returns: fixedCoordinate + difference; if difference < 0fixedCoordinate; else the coordinate which must be a corner fixedCoordinate, double the difference in the computed coordinate difference)Returns the minimum coordinate such that a rectangle starting from that coordinate will contain the fixed coordinate as a corner. |
| public static Point2D | Returns: either the specifiedpoint or the Point2D which is closest to it while still being
contained on the rectanglethe rectangle, Point2D Rectangle2D into which the point should be movedthe point)Point2D which is checkedMoves the specified point into the specified rectangle. |
| public static Rectangle2D | intersection(Rectangle2D a, Rectangle2D
another b)Rectangle2DReturns the rectangle which represents the intersection of the two specified rectangles. |
| private static double | Returns: the factor with which the width and height must be multiplied to stay within the bounds; always in the closed interval [0; 1]the center point of the new rectangle centerPoint, double the original width which might be too large width, double the original height which might be too large height, Rectangle2D the bounds within which the new rectangle will be located bounds)Computes the factor by which the specified width and height must be multiplied to keep a rectangle with their ratio and the specified center point within the specified bounds. |
| private static Point2D | Returns: eitherpoint or a new Point2D whose coordinates were changed so that it lies within the
boundsthe point to move into the point, Rectangle2D boundsthe bounds into which the bounds)point will be movedReturns either the specified point if if the specified bounds |
| private static Edge2D | Returns: either the specifiededge if it is with in the bounds or one with a corrected lengththe edge whose center point and orientation defines the returned edge's center point and orientation;
the center point must be within the bounds or an edge, Rectangle2D IllegalArgumentException will be thrownthe bounds within which the returned edge must be contained bounds)Returns an edge with the same center point and orientation as the specified edge. |
| private static Edge2D | Returns: anEdge2Dthe edge whose center point and orientation defines the returned edge's center point and orientation edge, Point2D the point to which the distance is measured point, double the ratio between the distance to the ratio)point and the returned edge's lengthReturns an edge with the same center point and orientation as the specified edge. |
| Rectangles2D | back to summary |
|---|---|
| public Rectangles2D() | |
| contains | back to summary |
|---|---|
| public static boolean contains(Rectangle2D rectangle, Edge2D edge) Indicates whether the specified rectangle contains the specified edge.
| |
| correctCoordinateDifferenceByRatio | back to summary |
|---|---|
| private static double correctCoordinateDifferenceByRatio(double difference, double otherDifference, double ratioAsMultiplier) Returns the difference with the following properties:
| |
| createForCenterAreaAndRatioWithinBounds | back to summary |
|---|---|
| private static Rectangle2D createForCenterAreaAndRatioWithinBounds(Point2D centerPoint, double area, double ratio, Rectangle2D bounds) Creates a new rectangle with the specified
| |
| createForEdgeAndOtherDimension | back to summary |
|---|---|
| private static Rectangle2D createForEdgeAndOtherDimension(Edge2D edge, double otherDimension) Returns a rectangle that has the specified edge and a height or width (depending on the edge's orientation) as
specified by
| |
| createForHorizontalEdgeAndHeight | back to summary |
|---|---|
| private static Rectangle2D createForHorizontalEdgeAndHeight(Edge2D horizontalEdge, double height) Returns a rectangle that has the specified horizontal edge and height. Depending on whether the width is positive or negative, the specified edge will be the upper or lower edge of the returned rectangle.
| |
| createForVerticalEdgeAndWidth | back to summary |
|---|---|
| private static Rectangle2D createForVerticalEdgeAndWidth(Edge2D verticalEdge, double width) Returns a rectangle that has the specified horizontal edge and width. Depending on whether the width is positive or negative, the specified edge will be the left or right edge of the returned rectangle.
| |
| createWithFixedRatioWithinBounds | back to summary |
|---|---|
| private static Rectangle2D createWithFixedRatioWithinBounds(Rectangle2D original, double ratio, Rectangle2D bounds) Creates a new rectangle with the same center point and area as the specified
| |
| fixRatio | back to summary |
|---|---|
| public static Rectangle2D fixRatio(Rectangle2D original, double ratio) Creates a new rectangle with the same center point and area as the specified
| |
| fixRatioWithinBounds | back to summary |
|---|---|
| public static Rectangle2D fixRatioWithinBounds(Rectangle2D original, double ratio, Rectangle2D bounds) Creates a new rectangle with the same center point and area (if possible) as the specified
| |
| forCenterAndAreaAndRatio | back to summary |
|---|---|
| public static Rectangle2D forCenterAndAreaAndRatio(Point2D centerPoint, double area, double ratio) Creates a new rectangle with the specified
| |
| forCenterAndAreaAndRatioWithinBounds | back to summary |
|---|---|
| public static Rectangle2D forCenterAndAreaAndRatioWithinBounds(Point2D centerPoint, double area, double ratio, Rectangle2D bounds) Creates a new rectangle with the specified
| |
| forCenterAndSize | back to summary |
|---|---|
| public static Rectangle2D forCenterAndSize(Point2D centerPoint, double width, double height) Creates a new rectangle with the specified center and the specified width and height.
| |
| forDiagonalCorners | back to summary |
|---|---|
| public static Rectangle2D forDiagonalCorners(Point2D oneCorner, Point2D diagonalCorner) Creates a new rectangle with the two specified corners. The two corners will be interpreted as being diagonal of each other.
| |
| forDiagonalCornersAndRatio | back to summary |
|---|---|
| public static Rectangle2D forDiagonalCornersAndRatio(Point2D fixedCorner, Point2D diagonalCorner, double ratio) Creates a new rectangle with the two specified corners. The two corners will be interpreted as being diagonal of
each other. The returned rectangle will have the specified
| |
| forEdgeAndOpposingPoint | back to summary |
|---|---|
| public static Rectangle2D forEdgeAndOpposingPoint(Edge2D edge, Point2D point) Returns a rectangle that has the specified edge and has its opposing edge on the parallel axis defined by the specified point's X or Y coordinate (depending on the edge's orientation).
| |
| forEdgeAndOpposingPointAndRatioWithinBounds | back to summary |
|---|---|
| public static Rectangle2D forEdgeAndOpposingPointAndRatioWithinBounds(Edge2D edge, Point2D point, double ratio, Rectangle2D bounds) Returns a rectangle that is principally defined by the specified edge and point. It should have the specified
edge as one of its own and its parallel edge should contain the point. While this would already well-define the
rectangle (compare
| |
| forUpperLeftCornerAndSize | back to summary |
|---|---|
| public static Rectangle2D forUpperLeftCornerAndSize(Point2D upperLeft, double width, double height) Creates a new rectangle with the specified
| |
| fromBounds | back to summary |
|---|---|
| public static Rectangle2D fromBounds(Bounds bounds) Returns a rectangle with the same coordinates as the specified bounds.
| |
| getCenterPoint | back to summary |
|---|---|
| public static Point2D getCenterPoint(Rectangle2D rectangle) Returns the center of the specified rectangle as a point.
| |
| getMinCoordinate | back to summary |
|---|---|
| private static double getMinCoordinate(double fixedCoordinate, double difference) Returns the minimum coordinate such that a rectangle starting from that coordinate will contain the fixed coordinate as a corner.
| |
| inRectangle | back to summary |
|---|---|
| public static Point2D inRectangle(Rectangle2D rectangle, Point2D point) Moves the specified point into the specified rectangle. If the point is already with the rectangle, it is returned. Otherwise the point in the rectangle which is closest to the specified one is returned.
| |
| intersection | back to summary |
|---|---|
| public static Rectangle2D intersection(Rectangle2D a, Rectangle2D b) Returns the rectangle which represents the intersection of the two specified rectangles.
| |
| lengthReductionToStayWithinBounds | back to summary |
|---|---|
| private static double lengthReductionToStayWithinBounds(Point2D centerPoint, double width, double height, Rectangle2D bounds) Computes the factor by which the specified width and height must be multiplied to keep a rectangle with their ratio and the specified center point within the specified bounds.
| |
| movePointIntoBounds | back to summary |
|---|---|
| private static Point2D movePointIntoBounds(Point2D point, Rectangle2D bounds) Returns either the specified point if if the specified bounds
| |
| resizeEdgeForBounds | back to summary |
|---|---|
| private static Edge2D resizeEdgeForBounds(Edge2D edge, Rectangle2D bounds) Returns an edge with the same center point and orientation as the specified edge. If necessary, its length is reduced to fit within the bounds.
| |
| resizeEdgeForDistanceAndRatio | back to summary |
|---|---|
| private static Edge2D resizeEdgeForDistanceAndRatio(Edge2D edge, Point2D point, double ratio) Returns an edge with the same center point and orientation as the specified edge. Its length has the specified ratio to the distance of the edge and the specified point. | |