Package com.massifmaps.core
Class ScreenBounds
java.lang.Object
com.massifmaps.core.ScreenBounds
A container class that defines a bounding box on the screen using minimum and maximum screen positions.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty ScreenBounds object.ScreenBounds(ScreenPos min, ScreenPos max) Constructs a ScreenBounds object from a minimum and maximum position. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(ScreenBounds bounds) Tests whether this screen bounds object contains a another screen bounds object.booleanTests whether this screen bounds object contains a screen position.booleanChecks if this object is equal to the specified object.Calculates the center screen position of this screen envelope object.floatReturns the height of the bounds object.getMax()Returns the maximum screen position of this screen envelope object.getMin()Returns the minimum screen position.floatgetWidth()Returns the width of the bounds object.inthashCode()Returns the hash value of this object.booleanintersects(ScreenBounds bounds) Tests whether this screen bounds object intersects with a another screen bounds object.toString()Creates a string representation of this screen bounds object, useful for logging.
-
Constructor Details
-
ScreenBounds
public ScreenBounds()Constructs an empty ScreenBounds object. The coordinates of the minimum position will be
set to positive infinity and the coordinates of the maximum position will be
set to negative infinity. -
ScreenBounds
Constructs a ScreenBounds object from a minimum and maximum position. If a coordinate of the
minimum positon is larger than the same coordinate of the maximum position then those
coordinates will be swapped.- Parameters:
min- The minimum position.max- The maximum position.
-
-
Method Details
-
equals
Checks if this object is equal to the specified object. -
hashCode
public int hashCode()Returns the hash value of this object. -
getCenter
Calculates the center screen position of this screen envelope object.- Returns:
- The center postion if this screen envelope object.
-
getWidth
public float getWidth()Returns the width of the bounds object.- Returns:
- The width on the bounds object.
-
getHeight
public float getHeight()Returns the height of the bounds object.- Returns:
- The height on the bounds object.
-
getMin
Returns the minimum screen position.- Returns:
- The minimum screen position.
-
getMax
Returns the maximum screen position of this screen envelope object.- Returns:
- The maximum screen position of this screen envelope object.
-
contains
Tests whether this screen bounds object contains a screen position.- Parameters:
pos- The screen position.- Returns:
- True if this screen bounds object contains the screen position.
-
contains
Tests whether this screen bounds object contains a another screen bounds object.- Parameters:
bounds- The other screen bounds object.- Returns:
- True if this screen bounds object contains the other screen bounds object.
-
intersects
Tests whether this screen bounds object intersects with a another screen bounds object.- Parameters:
bounds- The other screen bounds object.- Returns:
- True if this screen bounds object intersects with the other screen bounds object.
-
toString
Creates a string representation of this screen bounds object, useful for logging.
-