Package com.irurueta.geometry
Class Box2D
- All Implemented Interfaces:
Serializable
This class defines a 2D rectangular area aligned with the horizontal and vertical axes.
A box is defined by two corners, low, containing minimum coordinate values, and high,
containing maximum coordinate values.
This class is used internally by KD trees and quad trees.
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidfromRectangle(Rectangle rectangle) Sets values of this box from provided rectangle.final voidsetBounds(double loX, double loY, double hiX, double hiY) Sets boundaries.Creates a rectangle equivalent to this box.voidtoRectangle(Rectangle result) Sets values into provided rectangle to make it equivalent to this box.Methods inherited from class com.irurueta.geometry.Box
getDistance, getHi, getLo, getSqrDistance, setBounds, setHi, setLo
-
Constructor Details
-
Box2D
public Box2D()Empty constructor. Creates a box centered at the origin and having unitary area. -
Box2D
Constructor.- Parameters:
lo- low coordinate values.hi- high coordinate values.
-
Box2D
Constructor from rectangle.- Parameters:
rectangle- a rectangle.
-
-
Method Details
-
setBounds
public final void setBounds(double loX, double loY, double hiX, double hiY) Sets boundaries.- Parameters:
loX- horizontal low coordinate.loY- vertical low coordinate.hiX- horizontal high coordinate.hiY- vertical high coordinate.
-
fromRectangle
Sets values of this box from provided rectangle.- Parameters:
rectangle- a rectangle containing boundaries.
-
toRectangle
Creates a rectangle equivalent to this box.- Returns:
- a rectangle equivalent to this box.
-
toRectangle
Sets values into provided rectangle to make it equivalent to this box.- Parameters:
result- instance where values will be stored.
-