Package icyllis.arc3d.core
Interface Rect2ic
- All Known Implementing Classes:
Rect2i
Interface to a read-only view of a rectangle in integer coordinates.
This does not mean that the rectangle is immutable, it only implies that
a method should not change the state of the rectangle.
Rect2i const &rect
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionint
bottom()
Return the rectangle's bottom.boolean
contains
(float x, float y) Returns true if (x,y) is inside the rectangle.boolean
contains
(int x, int y) Returns true if (x,y) is inside the 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.int
height()
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
isSorted()
Returns true if left is equal to or less than right, or if top is equal to or less than bottom.int
left()
Returns the rectangle's left.int
right()
Return the rectangle's right.void
Stores the coordinates from this into dst.void
Stores the coordinates from this into dst.int
top()
Return the rectangle's top.int
width()
int
x()
Returns the rectangle's left.int
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
-
x
int x()Returns the rectangle's left. -
y
int y()Return the rectangle's top. -
left
int left()Returns the rectangle's left. -
top
int top()Return the rectangle's top. -
right
int right()Return the rectangle's right. -
bottom
int bottom()Return the rectangle's bottom. -
width
int 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
int 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.
-
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
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.
-
contains
boolean contains(int x, int 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 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
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
-