Package icyllis.arc3d.core
Interface Rect2fc
- All Known Implementing Classes:
CircularRRectOp
,ClearOp
,DrawOp
,MeshDrawOp
,Op
,Rect2f
,RectOp
,RoundRectOp
Interface to a read-only view of a rectangle in float coordinates.
This does not mean that the rectangle is immutable, it only implies that
a method should not change the state of the rectangle.
Rect2f const &rect
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionfloat
bottom()
Return the rectangle's bottom.float
centerX()
float
centerY()
boolean
contains
(float x, float y) Returns true if (x,y) is inside the rectangle.boolean
contains
(float left, float top, float right, float bottom) Returns true if the 4 specified sides of a rectangle are inside or equal to this rectangle.boolean
Returns true if the specified rectangle r is inside or equal to this rectangle.boolean
Returns true if the specified rectangle r is inside or equal to this rectangle.float
height()
boolean
intersects
(float left, float top, float right, float bottom) Returns true if this rectangle intersects the specified rectangle.boolean
Returns true if this rectangle intersects the specified rectangle.boolean
Returns true if this rectangle intersects the specified rectangle.boolean
isEmpty()
Returns true if left is equal to or greater than right, or if top is equal to or greater than bottom.boolean
isFinite()
Returns true if all values in the rectangle are finite.boolean
isSorted()
Returns true if left is equal to or less than right, or if top is equal to or less than bottom.float
left()
Returns the rectangle's left.float
right()
Return the rectangle's right.void
Set the dst rectangle by rounding this rectangle's coordinates to their nearest integer values.void
Set the dst integer Rect by rounding this rectangle's coordinates to their nearest integer values.void
Set the dst rectangle by rounding "in" this rectangle, choosing the ceiling of top and left, and the floor of right and bottom.void
Set the dst integer Rect by rounding "in" this rectangle, choosing the ceiling of top and left, and the floor of right and bottom.void
Set the dst rectangle by rounding "out" this rectangle, choosing the floor of top and left, and the ceiling of right and bottom.void
Set the dst integer Rect by rounding "out" this rectangle, choosing the floor of top and left, and the ceiling of right and bottom.void
Stores the coordinates from this into dst.void
Stores the coordinates from this into dst.float
top()
Return the rectangle's top.float
width()
float
x()
Returns the rectangle's left.float
y()
Return the rectangle's top.
-
Method Details
-
isEmpty
boolean isEmpty()Returns true if left is equal to or greater than right, or if top is equal to or greater than bottom. Call sort() to reverse rectangles with negative width() or height().- Returns:
- true if width() or height() are zero or negative
-
isSorted
boolean isSorted()Returns true if left is equal to or less than right, or if top is equal to or less than bottom. Call sort() to reverse rectangles with negative width() or height().- Returns:
- true if width() or height() are zero or positive
-
isFinite
boolean isFinite()Returns true if all values in the rectangle are finite.- Returns:
- true if no member is infinite or NaN
-
x
float x()Returns the rectangle's left. -
y
float y()Return the rectangle's top. -
left
float left()Returns the rectangle's left. -
top
float top()Return the rectangle's top. -
right
float right()Return the rectangle's right. -
bottom
float bottom()Return the rectangle's bottom. -
width
float width()- Returns:
- the rectangle's width. This does not check for a valid rectangle (i.e. left invalid input: '<'= right) so the result may be negative.
-
height
float height()- Returns:
- the rectangle's height. This does not check for a valid rectangle (i.e. top invalid input: '<'= bottom) so the result may be negative.
-
centerX
float centerX()- Returns:
- the horizontal center of the rectangle. This does not check for a valid rectangle (i.e. left invalid input: '<'= right)
-
centerY
float centerY()- Returns:
- the vertical center of the rectangle. This does not check for a valid rectangle (i.e. top invalid input: '<'= bottom)
-
store
Stores the coordinates from this into dst.- Parameters:
dst
- the rectangle to store
-
store
Stores the coordinates from this into dst.- Parameters:
dst
- the rectangle to store
-
intersects
boolean intersects(float left, float top, float right, float bottom) Returns true if this rectangle intersects the specified rectangle. In no event is this rectangle modified. To record the intersection, use intersect().- Parameters:
left
- the left side of the rectangle being tested for intersectiontop
- the top of the rectangle being tested for intersectionright
- the right side of the rectangle being tested for intersectionbottom
- the bottom of the rectangle being tested for intersection- Returns:
- true if the specified rectangle intersects this rectangle. In no event is this rectangle modified.
-
intersects
Returns true if this rectangle intersects the specified rectangle. In no event is this rectangle modified.- Parameters:
r
- the rectangle being tested for intersection- Returns:
- true if the specified rectangle intersects this rectangle. In no event is this rectangle modified.
-
intersects
Returns true if this rectangle intersects the specified rectangle. In no event is this rectangle modified. To record the intersection, use intersect().- Parameters:
r
- the rectangle being tested for intersection- Returns:
- true if the specified rectangle intersects this rectangle. In no event is this rectangle modified.
-
contains
boolean contains(float x, float y) Returns true if (x,y) is inside the rectangle. The left and top are considered to be inside, while the right and bottom are not. This means that for a (x,y) to be contained: left invalid input: '<'= x invalid input: '<' right and top invalid input: '<'= y invalid input: '<' bottom. An empty rectangle never contains any point.- Parameters:
x
- the X coordinate of the point being tested for containmenty
- the Y coordinate of the point being tested for containment- Returns:
- true if (x,y) are contained by the rectangle, where containment means left invalid input: '<'= x invalid input: '<' right and top invalid input: '<'= y invalid input: '<' bottom
-
contains
boolean contains(float left, float top, float right, float bottom) Returns true if the 4 specified sides of a rectangle are inside or equal to this rectangle. i.e. is this rectangle a superset of the specified rectangle. An empty rectangle never contains another rectangle.- Parameters:
left
- the left side of the rectangle being tested for containmenttop
- the top of the rectangle being tested for containmentright
- the right side of the rectangle being tested for containmentbottom
- the bottom of the rectangle being tested for containment- Returns:
- true if the 4 specified sides of a rectangle are inside or equal to this rectangle
-
contains
Returns true if the specified rectangle r is inside or equal to this rectangle. An empty rectangle never contains another rectangle.- Parameters:
r
- the rectangle being tested for containment.- Returns:
- true if the specified rectangle r is inside or equal to this rectangle
-
contains
Returns true if the specified rectangle r is inside or equal to this rectangle. An empty rectangle never contains another rectangle.- Parameters:
r
- the rectangle being tested for containment.- Returns:
- true if the specified rectangle r is inside or equal to this rectangle
-
round
Set the dst integer Rect by rounding this rectangle's coordinates to their nearest integer values. -
roundIn
Set the dst integer Rect by rounding "in" this rectangle, choosing the ceiling of top and left, and the floor of right and bottom. -
roundOut
Set the dst integer Rect by rounding "out" this rectangle, choosing the floor of top and left, and the ceiling of right and bottom. -
round
Set the dst rectangle by rounding this rectangle's coordinates to their nearest integer values. -
roundIn
Set the dst rectangle by rounding "in" this rectangle, choosing the ceiling of top and left, and the floor of right and bottom. -
roundOut
Set the dst rectangle by rounding "out" this rectangle, choosing the floor of top and left, and the ceiling of right and bottom.
-