-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @NonNull javafx.geometry.BoundingBoxstatic @NonNull javafx.geometry.Point2Dstatic @NonNull javafx.geometry.Point2DCalculate the center of the given boundsstatic @NonNull javafx.geometry.Point2DCalculate the center of the given boundsstatic booleanReturns true if the bounds contain the specified point within the given tolerance.static booleanReturns true if the bounds contain the specified point within the given tolerance.static booleanReturns true, if rectangle 1 contains rectangle 2.static @NonNull javafx.geometry.Point2Dstatic @NonNull javafx.geometry.BoundingBoxGets the bounds of the specified shape.static @NonNull javafx.geometry.BoundsGets the bounds of the specified shape.static @NonNull javafx.geometry.BoundsResizes theBoundsboth horizontally and vertically.static @NonNull javafx.geometry.BoundsResizes theBoundsboth horizontally and vertically.static @NonNull javafx.geometry.Rectangle2DResizes theRectangle2Dboth horizontally and vertically.static @NonNull javafx.geometry.Boundsintersection(@NonNull javafx.geometry.Bounds a, @NonNull javafx.geometry.Bounds b) static booleanReturns true if the widht or the height is less or equal 0.static booleanReturns true if the given bounds are finite.static @NonNull javafx.geometry.Point2Dstatic intThis 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 @NonNull javafx.geometry.Point2Dstatic @NonNull Rectangle2D.DoubletoAwtRectangle2D(@NonNull javafx.geometry.Bounds r) Converts a bounding box to a AWT rectangle.static @NonNull javafx.geometry.Rectangle2DtoRectangle2D(@NonNull javafx.geometry.Bounds r) Converts a bounding box to a FX rectangle.static @NonNull javafx.geometry.Boundsstatic @NonNull javafx.geometry.Point2D
-
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
Converts a bounding box to a FX rectangle.- Parameters:
r- a bounding box- Returns:
- the rectangle
-
add
-
center
Calculate the center of the given bounds- Parameters:
r- the bounds- Returns:
- the center
-
contains
public static boolean contains(@NonNull javafx.geometry.Bounds r, @NonNull 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(@NonNull 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
Gets the bounds of the specified shape.- Parameters:
r- a rectangle- Returns:
- JavaFX bounds
-
grow
public static @NonNull javafx.geometry.Bounds grow(@NonNull 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
Resizes theBoundsboth horizontally and vertically.- Parameters:
r- the boundshv- the horizontal and vertical expansion- Returns:
- the new rectangle
- See Also:
-
union
-
isFinite
Returns true if the given bounds are finite.- Parameters:
bounds- the bounds- Returns:
- true if finiite
-
intersection
-
center
-
center
Calculate the center of the given bounds- Parameters:
r- the bounds- Returns:
- the center
-
east
-
north
-
outcode
public static int outcode(@NonNull javafx.geometry.Rectangle2D r1, @NonNull 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
-
isEmpty
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(@NonNull javafx.geometry.Rectangle2D r1, @NonNull 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 @NonNull javafx.geometry.Rectangle2D grow(@NonNull 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
-