Package com.jogamp.nativewindow.util
Interface RectangleImmutable
-
- All Superinterfaces:
Comparable<RectangleImmutable>
,WriteCloneable
- All Known Implementing Classes:
Rectangle
public interface RectangleImmutable extends WriteCloneable, Comparable<RectangleImmutable>
Immutable Rectangle interface, with its position on the top-left.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
compareTo(RectangleImmutable d)
Compares square of size 1st, if equal the square of position.boolean
contains(RectangleImmutable r)
float
coverage(RectangleImmutable r)
Returns the coverage of given rectangle w/ this this one, i.e.boolean
equals(Object obj)
Checks whether two rect objects are equal.int
getHeight()
int
getWidth()
int
getX()
x-position, left of rectangle.int
getY()
y-position, top of rectangle.int
hashCode()
Rectangle
intersection(int rx1, int ry1, int rx2, int ry2)
Returns a newRectangle
instance containing the intersection of this rectangle and the given coordinates.Rectangle
intersection(RectangleImmutable r)
Returns a newRectangle
instance containing the intersection of this rectangle and the given rectangle.Rectangle
union(int rx1, int ry1, int rx2, int ry2)
Returns a newRectangle
instance containing the union of this rectangle and the given coordinates.Rectangle
union(RectangleImmutable r)
Returns a newRectangle
instance containing the union of this rectangle and the given rectangle.Rectangle
union(List<RectangleImmutable> rectangles)
Calculates the union of the given rectangles, stores it in this instance and returns this instance.-
Methods inherited from interface com.jogamp.common.type.WriteCloneable
cloneMutable
-
-
-
-
Method Detail
-
getHeight
int getHeight()
-
getWidth
int getWidth()
-
getX
int getX()
x-position, left of rectangle.
-
getY
int getY()
y-position, top of rectangle.
-
union
Rectangle union(RectangleImmutable r)
Returns a newRectangle
instance containing the union of this rectangle and the given rectangle.
-
union
Rectangle union(int rx1, int ry1, int rx2, int ry2)
Returns a newRectangle
instance containing the union of this rectangle and the given coordinates.
-
union
Rectangle union(List<RectangleImmutable> rectangles)
Calculates the union of the given rectangles, stores it in this instance and returns this instance.- Parameters:
rectangles
- given list of rectangles- Returns:
- this instance holding the union of given rectangles.
-
intersection
Rectangle intersection(RectangleImmutable r)
Returns a newRectangle
instance containing the intersection of this rectangle and the given rectangle.
-
intersection
Rectangle intersection(int rx1, int ry1, int rx2, int ry2)
Returns a newRectangle
instance containing the intersection of this rectangle and the given coordinates.
-
coverage
float coverage(RectangleImmutable r)
Returns the coverage of given rectangle w/ this this one, i.e. between0.0
and1.0
.Coverage is computed by:
isect = this.intersection(r); coverage = area( isect ) / area( this ) ;
-
contains
boolean contains(RectangleImmutable r)
-
compareTo
int compareTo(RectangleImmutable d)
Compares square of size 1st, if equal the square of position.
- Specified by:
compareTo
in interfaceComparable<RectangleImmutable>
-
equals
boolean equals(Object obj)
Checks whether two rect objects are equal. Two instances ofRectangle
are equal if the four integer values of the fieldsy
,x
,height
, andwidth
are all equal.
-
-