-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic javafx.geometry.BoundingBoxadd(javafx.geometry.Bounds a, javafx.geometry.Bounds b) static javafx.geometry.Point2Dstatic javafx.geometry.Point2Dcenter(javafx.geometry.Bounds r) Calculate the center of the given boundsstatic javafx.geometry.Point2Dcenter(javafx.geometry.Rectangle2D r) Calculate the center of the given boundsstatic booleancontains(javafx.geometry.Bounds r, double x, double y, double tolerance) Returns true if the bounds contain the specified point within the given tolerance.static booleancontains(javafx.geometry.Bounds r, javafx.geometry.Point2D p, double tolerance) Returns true if the bounds contain the specified point within the given tolerance.static booleancontains(javafx.geometry.Rectangle2D r1, javafx.geometry.Rectangle2D r2) Returns true, if rectangle 1 contains rectangle 2.static javafx.geometry.Point2Deast(javafx.geometry.Rectangle2D r) static javafx.geometry.BoundingBoxGets the bounds of the specified shape.static javafx.geometry.BoundsgetBounds(javafx.geometry.Rectangle2D r) Gets the bounds of the specified shape.static javafx.geometry.Boundsgrow(javafx.geometry.Bounds r, double hv) Resizes theBoundsboth horizontally and vertically.static javafx.geometry.Boundsgrow(javafx.geometry.Bounds r, double h, double v) Resizes theBoundsboth horizontally and vertically.static javafx.geometry.Rectangle2Dgrow(javafx.geometry.Rectangle2D r, double h, double v) Resizes theRectangle2Dboth horizontally and vertically.static javafx.geometry.Boundsintersection(javafx.geometry.Bounds a, javafx.geometry.Bounds b) static booleanisEmpty(javafx.geometry.Rectangle2D b) Returns true if the widht or the height is less or equal 0.static booleanisFinite(javafx.geometry.Bounds bounds) Returns true if the given bounds are finite.static javafx.geometry.Point2Dnorth(javafx.geometry.Rectangle2D r) static intoutcode(javafx.geometry.Rectangle2D r1, javafx.geometry.Rectangle2D r2) This method computes a binary OR of the appropriate mask values indicating, for each side of Rectangle2D r1, whether or not the Rectangle2D r2 is on the same side of the edge as the rest of this Rectangle2D.static javafx.geometry.Point2Dsouth(javafx.geometry.Rectangle2D r) static Rectangle2D.DoubletoAwtRectangle2D(javafx.geometry.Bounds r) Converts a bounding box to a AWT rectangle.static javafx.geometry.Rectangle2DtoRectangle2D(javafx.geometry.Bounds r) Converts a bounding box to a FX rectangle.static StringtoString(@Nullable javafx.geometry.Bounds b) static StringtoString(@Nullable javafx.geometry.Rectangle2D b) static javafx.geometry.Boundsunion(javafx.geometry.Bounds a, javafx.geometry.Bounds... bs) static javafx.geometry.Point2Dwest(javafx.geometry.Rectangle2D r)
-
Constructor Details
-
FXRectangles
public FXRectangles()
-
-
Method Details
-
getBounds
Gets the bounds of the specified shape.- Parameters:
shape- an AWT shape- Returns:
- JavaFX bounds
-
toAwtRectangle2D
Converts a bounding box to a AWT rectangle.- Parameters:
r- a bounding box- Returns:
- the rectangle
-
toRectangle2D
public static javafx.geometry.Rectangle2D toRectangle2D(javafx.geometry.Bounds r) Converts a bounding box to a FX rectangle.- Parameters:
r- a bounding box- Returns:
- the rectangle
-
add
public static javafx.geometry.BoundingBox add(javafx.geometry.Bounds a, javafx.geometry.Bounds b) -
center
public static javafx.geometry.Point2D center(javafx.geometry.Bounds r) Calculate the center of the given bounds- Parameters:
r- the bounds- Returns:
- the center
-
contains
public static boolean contains(javafx.geometry.Bounds r, javafx.geometry.Point2D p, double tolerance) Returns true if the bounds contain the specified point within the given tolerance.- Parameters:
r- the boundsp- the pointtolerance- the tolerance- Returns:
- true if inside
-
contains
public static boolean contains(javafx.geometry.Bounds r, double x, double y, double tolerance) Returns true if the bounds contain the specified point within the given tolerance.- Parameters:
r- the boundsx- the x-coordinate of the pointy- the y-coordinate of the pointtolerance- the tolerance- Returns:
- true if inside
-
getBounds
public static javafx.geometry.Bounds getBounds(javafx.geometry.Rectangle2D r) Gets the bounds of the specified shape.- Parameters:
r- a rectangle- Returns:
- JavaFX bounds
-
grow
public static javafx.geometry.Bounds grow(javafx.geometry.Bounds r, double h, double v) Resizes theBoundsboth horizontally and vertically.This method returns a new
Boundsso that it ishunits larger on both the left and right side, andvunits larger at both the top and bottom.The new
Boundshas (x - h,y - v) as its top-left corner, a width ofwidth+2h, and a height ofheight+2v.If negative values are supplied for
handv, the size of theRectangle2Ddecreases accordingly. Thegrowmethod does not check whether the resulting values ofwidthandheightare non-negative.- Parameters:
r- the boundsh- the horizontal expansionv- the vertical expansion- Returns:
- the new rectangle
-
grow
public static javafx.geometry.Bounds grow(javafx.geometry.Bounds r, double hv) Resizes theBoundsboth horizontally and vertically.- Parameters:
r- the boundshv- the horizontal and vertical expansion- Returns:
- the new rectangle
- See Also:
-
union
public static javafx.geometry.Bounds union(javafx.geometry.Bounds a, javafx.geometry.Bounds... bs) -
isFinite
public static boolean isFinite(javafx.geometry.Bounds bounds) Returns true if the given bounds are finite.- Parameters:
bounds- the bounds- Returns:
- true if finiite
-
intersection
public static javafx.geometry.Bounds intersection(javafx.geometry.Bounds a, javafx.geometry.Bounds b) -
center
-
center
public static javafx.geometry.Point2D center(javafx.geometry.Rectangle2D r) Calculate the center of the given bounds- Parameters:
r- the bounds- Returns:
- the center
-
east
public static javafx.geometry.Point2D east(javafx.geometry.Rectangle2D r) -
north
public static javafx.geometry.Point2D north(javafx.geometry.Rectangle2D r) -
outcode
public static int outcode(javafx.geometry.Rectangle2D r1, javafx.geometry.Rectangle2D r2) This method computes a binary OR of the appropriate mask values indicating, for each side of Rectangle2D r1, whether or not the Rectangle2D r2 is on the same side of the edge as the rest of this Rectangle2D.- Parameters:
r1- rectangle 1r2- rectangle 2- Returns:
- the logical OR of all appropriate out codes OUT_RIGHT, OUT_LEFT, OUT_BOTTOM, OUT_TOP.
-
south
public static javafx.geometry.Point2D south(javafx.geometry.Rectangle2D r) -
isEmpty
public static boolean isEmpty(javafx.geometry.Rectangle2D b) Returns true if the widht or the height is less or equal 0.- Parameters:
b- a rectangle- Returns:
- true if empty
-
toString
-
contains
public static boolean contains(javafx.geometry.Rectangle2D r1, javafx.geometry.Rectangle2D r2) Returns true, if rectangle 1 contains rectangle 2.This method is similar to Rectangle2D.contains, but also returns true, when rectangle1 contains rectangle2 and either or both of them are empty.
- Parameters:
r1- Rectangle2D 1.r2- Rectangle2D 2.- Returns:
- true if r1 contains r2.
-
grow
public static javafx.geometry.Rectangle2D grow(javafx.geometry.Rectangle2D r, double h, double v) Resizes theRectangle2Dboth horizontally and vertically.This method returns a new
Rectangle2Dso that it ishunits larger on both the left and right side, andvunits larger at both the top and bottom.The new
Rectangle2Dhas (x - h,y - v) as its top-left corner, a width ofwidth+2h, and a height ofheight+2v.If negative values are supplied for
handv, the size of theRectangle2Ddecreases accordingly. Thegrowmethod does not check whether the resulting values ofwidthandheightare non-negative.- Parameters:
r- the rectangleh- the horizontal expansionv- the vertical expansion- Returns:
- the new rectangle
-
toString
-
west
public static javafx.geometry.Point2D west(javafx.geometry.Rectangle2D r)
-