java.lang.Object
org.jhotdraw8.geom.Rectangles
Provides geometry utility functions.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe bitmask that indicates that a point lies below the rectangle.static final intThe bitmask that indicates that a point lies to the left of the rectangle.static final intThe bitmask that indicates that a point lies to the right of the rectangle.static final intThe bitmask that indicates that a point lies above the rectangle.static final doubleAbsolute threshold to be used for comparing reals generally. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontains(double rx, double ry, double rw, double rh, double x, double y, double tolerance) Returns true if the bounds contain the specified point within the given tolerance.static booleanReturns true, if rectangle 1 contains rectangle 2.
-
Field Details
-
OUT_BOTTOM
public static final int OUT_BOTTOMThe bitmask that indicates that a point lies below the rectangle.- See Also:
-
OUT_LEFT
public static final int OUT_LEFTThe bitmask that indicates that a point lies to the left of the rectangle.- See Also:
-
OUT_RIGHT
public static final int OUT_RIGHTThe bitmask that indicates that a point lies to the right of the rectangle.- See Also:
-
OUT_TOP
public static final int OUT_TOPThe bitmask that indicates that a point lies above the rectangle.- See Also:
-
REAL_THRESHOLD
public static final double REAL_THRESHOLDAbsolute threshold to be used for comparing reals generally.- See Also:
-
-
Method Details
-
contains
public static boolean contains(double rx, double ry, double rw, double rh, double x, double y, double tolerance) Returns true if the bounds contain the specified point within the given tolerance.- Parameters:
rx- the bounds x-coordinatery- the bounds y-coordinaterw- the bounds widthrh- the bounds heightx- the x-coordinate of the pointy- the y-coordinate of the pointtolerance- the tolerance- Returns:
- true if inside
-
containsAWT
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- Rectangle 1.r2- Rectangle 2.- Returns:
- true if r1 contains r2.
-