MutableBox
public final class MutableBox extends Box
A mutable axis-aligned rectangle. See ImmutableBox for an immutable version.
Note that unlike android.graphics.RectF, this does not express an opinion about axis direction (e.g. the positive Y axis being "down"), because it is intended to be used with any coordinate system rather than just Android screen/View space.
Summary
Public constructors |
|---|
|
Constructs a |
Public methods |
|
|---|---|
boolean |
|
float |
getXMax()The upper bound in the |
float |
getXMin()The lower bound in the |
float |
getYMax()The upper bound in the |
float |
getYMin()The lower bound in the |
int |
hashCode() |
final @NonNull MutableBox |
populateFrom(@NonNull Box input)Fills this |
final @NonNull MutableBox |
populateFromCenterAndDimensions(Constructs a |
final @NonNull MutableBox |
populateFromTwoPoints(@NonNull Vec point1, @NonNull Vec point2)Constructs the smallest |
final @NonNull MutableBox |
setXBounds(float x1, float x2)Sets the lower and upper bounds in the |
final @NonNull MutableBox |
setYBounds(float y1, float y2)Sets the lower and upper bounds in the |
@NonNull String |
toString() |
Inherited methods |
||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
MutableBox
public MutableBox()
Constructs a MutableBox without any initial data. Fill with the appropriate setters or factory functions.
Public methods
populateFrom
public final @NonNull MutableBox populateFrom(@NonNull Box input)
Fills this MutableBox with the same values contained in input.
populateFromCenterAndDimensions
public final @NonNull MutableBox populateFromCenterAndDimensions(
@NonNull Vec center,
@FloatRange(from = 0.0) float width,
@FloatRange(from = 0.0) float height
)
Constructs a MutableBox with a given center, width, and height. width and height must be non-negative numbers.
populateFromTwoPoints
public final @NonNull MutableBox populateFromTwoPoints(@NonNull Vec point1, @NonNull Vec point2)
Constructs the smallest MutableBox containing the two given points.
setXBounds
public final @NonNull MutableBox setXBounds(float x1, float x2)
Sets the lower and upper bounds in the X direction to new values. The minimum value becomes xMin, and the maximum value becomes xMax. Returns the same instance to chain function calls.
setYBounds
public final @NonNull MutableBox setYBounds(float y1, float y2)
Sets the lower and upper bounds in the Y direction to new values. The minimum value becomes yMin, and the maximum value becomes yMax. Returns the same instance to chain function calls.