BoundingBox
final class BoundingBox
Package: dev.joid.lib.utils.geom · Module: core · Source: BoundingBox.java
Mutable rectangle stored by its minimum and maximum corners, in design pixels.
Description
Section titled “Description”expand(...) and contract(...) change this box; copy() first to keep the original.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
BoundingBox | create(double x, double y, double width, double height) factory | Returns the box whose top-left corner is (x, y) and whose size is width × height. |
Methods
Section titled “Methods”Position and size
Section titled “Position and size”| Returns | Signature | Summary |
|---|---|---|
double | getWidth() | Returns the width, maxX - minX. |
double | getHeight() | Returns the height, maxY - minY. |
Queries
Section titled “Queries”| Returns | Signature | Summary |
|---|---|---|
double | getMinX() | Returns the left edge. |
double | getMinY() | Returns the top edge. |
double | getMaxX() | Returns the right edge. |
double | getMaxY() | Returns the bottom edge. |
Actions
Section titled “Actions”| Returns | Signature | Summary |
|---|---|---|
BoundingBox | copy() | Returns another box with the same corners. |
this | expand(double value) fluent | Moves every side outward by value, then returns this box. |
this | contract(double value) fluent | Moves every side inward by value, then returns this box. |
void | setMinX(double minX) | Moves the left edge. |
void | setMinY(double minY) | Moves the top edge. |
void | setMaxX(double maxX) | Moves the right edge. |
void | setMaxY(double maxY) | Moves the bottom edge. |
boolean | equals(Object other) | If true, the other object is a box with the same four edges. |
int | hashCode() | Returns a hash of the values that equals compares. |
Creation details
Section titled “Creation details”create
Section titled “create”BoundingBox create(double x, double y, double width, double height) factory
Returns the box whose top-left corner is (x, y) and whose size is width × height.
Method details
Section titled “Method details”getWidth
Section titled “getWidth”double getWidth()
Returns the width, maxX - minX.
getHeight
Section titled “getHeight”double getHeight()
Returns the height, maxY - minY.
getMinX
Section titled “getMinX”double getMinX()
Returns the left edge.
getMinY
Section titled “getMinY”double getMinY()
Returns the top edge.
getMaxX
Section titled “getMaxX”double getMaxX()
Returns the right edge.
getMaxY
Section titled “getMaxY”double getMaxY()
Returns the bottom edge.
BoundingBox copy()
Returns another box with the same corners.
expand
Section titled “expand”this expand(double value) fluent
Moves every side outward by value, then returns this box.
contract
Section titled “contract”this contract(double value) fluent
Moves every side inward by value, then returns this box.
setMinX
Section titled “setMinX”void setMinX(double minX)
Moves the left edge.
setMinY
Section titled “setMinY”void setMinY(double minY)
Moves the top edge.
setMaxX
Section titled “setMaxX”void setMaxX(double maxX)
Moves the right edge.
setMaxY
Section titled “setMaxY”void setMaxY(double maxY)
Moves the bottom edge.
equals
Section titled “equals”boolean equals(Object other)
If true, the other object is a box with the same four edges.
hashCode
Section titled “hashCode”int hashCode()
Returns a hash of the values that equals compares.
fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses
