Package gaiasky.util.math
Class BoundingBoxDouble
java.lang.Object
gaiasky.util.math.BoundingBoxDouble
- All Implemented Interfaces:
Serializable
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructs a new bounding box with the minimum and maximum vector set to zeros.BoundingBoxDouble
(BoundingBoxDouble bounds) Constructs a new bounding box from the given bounding box.BoundingBoxDouble
(Vector3d minimum, Vector3d maximum) Constructs the new bounding box using the given minimum and maximum vector. -
Method Summary
Modifier and TypeMethodDescriptionclr()
Sets the minimum and maximum vector to zeros.boolean
contains
(double x, double y, double z) Returns whether the given position [xyz] is contained in this bounding box.boolean
Returns whether the given bounding box is contained in this bounding box.boolean
Returns whether the given vector is contained in this bounding box.ext
(double x, double y, double z) Extends the bounding box by the given vector.ext
(BoundingBoxDouble a_bounds) Extends this bounding box by the given bounding box.ext
(BoundingBoxDouble bounds, Matrix4d transform) Extends this bounding box by the given transformed bounding box.Extends the bounding box to incorporate the givenVector3d
.Deprecated.double
double
double
getCorner000
(Vector3d out) getCorner001
(Vector3d out) getCorner010
(Vector3d out) getCorner011
(Vector3d out) getCorner100
(Vector3d out) getCorner101
(Vector3d out) getCorner110
(Vector3d out) getCorner111
(Vector3d out) Vector3d[]
Deprecated.Use the getCornerXYZ methods insteaddouble
getDepth()
Deprecated.UsegetDimensions(Vector3d)
insteadgetDimensions
(Vector3d out) double
getMax()
Deprecated.UsegetMax(Vector3d)
insteadgetMin()
Deprecated.UsegetMin(Vector3d)
instead.double
double
getWidth()
inf()
Sets the minimum and maximum vector to positive and negative infinity.boolean
Returns whether the given bounding box is intersecting this bounding box (at least one point in).boolean
isValid()
Returns whether this bounding box is valid.Multiplies the bounding box by the given matrix.com.badlogic.gdx.math.collision.BoundingBox
put
(com.badlogic.gdx.math.collision.BoundingBox bounds) set
(BoundingBoxDouble bounds) Sets the given bounding box.Sets the bounding box minimum and maximum vector from the given points.Sets the given minimum and maximum vector.Sets the bounding box minimum and maximum vector from the given points.toString()
protected void
Deprecated.
-
Field Details
-
min
-
max
-
-
Constructor Details
-
BoundingBoxDouble
public BoundingBoxDouble()Constructs a new bounding box with the minimum and maximum vector set to zeros. -
BoundingBoxDouble
Constructs a new bounding box from the given bounding box.- Parameters:
bounds
- The bounding box to copy
-
BoundingBoxDouble
Constructs the new bounding box using the given minimum and maximum vector.- Parameters:
minimum
- The minimum vectormaximum
- The maximum vector
-
-
Method Details
-
getCenter
Deprecated.- Returns:
- the center of the bounding box
-
getCenter
- Parameters:
out
- TheVector3d
to receive the center of the bounding box.- Returns:
- The vector specified with the out argument.
-
getCenterX
public double getCenterX() -
getCenterY
public double getCenterY() -
getCenterZ
public double getCenterZ() -
updateCorners
Deprecated. -
getCorners
Deprecated.Use the getCornerXYZ methods instead- Returns:
- the corners of this bounding box
-
getCorner000
-
getCorner001
-
getCorner010
-
getCorner011
-
getCorner100
-
getCorner101
-
getCorner110
-
getCorner111
-
getDimensions
Deprecated.UsegetDimensions(Vector3d)
instead- Returns:
- The dimensions of this bounding box on all three axis
-
getDimensions
- Parameters:
out
- TheVector3d
to receive the dimensions of this bounding box on all three axis.- Returns:
- The vector specified with the out argument
-
getVolume
public double getVolume() -
getWidth
public double getWidth() -
getHeight
public double getHeight() -
getDepth
public double getDepth() -
getMin
Deprecated.UsegetMin(Vector3d)
instead.- Returns:
- The minimum vector
-
getMin
- Parameters:
out
- TheVector3d
to receive the minimum values.- Returns:
- The vector specified with the out argument
-
getMax
Deprecated.UsegetMax(Vector3d)
instead- Returns:
- The maximum vector
-
getMax
- Parameters:
out
- TheVector3d
to receive the maximum values.- Returns:
- The vector specified with the out argument
-
set
Sets the given bounding box.- Parameters:
bounds
- The bounds.- Returns:
- This bounding box for chaining.
-
put
public com.badlogic.gdx.math.collision.BoundingBox put(com.badlogic.gdx.math.collision.BoundingBox bounds) -
set
Sets the given minimum and maximum vector.- Parameters:
minimum
- The minimum vectormaximum
- The maximum vector- Returns:
- This bounding box for chaining.
-
set
Sets the bounding box minimum and maximum vector from the given points.- Parameters:
points
- The points.- Returns:
- This bounding box for chaining.
-
set
Sets the bounding box minimum and maximum vector from the given points.- Parameters:
points
- The points.- Returns:
- This bounding box for chaining.
-
inf
Sets the minimum and maximum vector to positive and negative infinity.- Returns:
- This bounding box for chaining.
-
ext
Extends the bounding box to incorporate the givenVector3d
.- Parameters:
point
- The vector- Returns:
- This bounding box for chaining.
-
clr
Sets the minimum and maximum vector to zeros.- Returns:
- This bounding box for chaining.
-
isValid
public boolean isValid()- Returns:
- True in case the bounding box is valid, false otherwise
-
ext
Extends this bounding box by the given bounding box.- Parameters:
a_bounds
- The bounding box- Returns:
- This bounding box for chaining.
-
ext
Extends this bounding box by the given transformed bounding box.- Parameters:
bounds
- The bounding boxtransform
- The transformation matrix to apply to bounds, before using it to extend this bounding box.- Returns:
- This bounding box for chaining.
-
mul
Multiplies the bounding box by the given matrix. This is achieved by multiplying the 8 corner points and then calculating the minimum and maximum vectors from the transformed points.- Parameters:
transform
- The matrix- Returns:
- This bounding box for chaining.
-
contains
Returns whether the given bounding box is contained in this bounding box.- Parameters:
b
- The bounding box- Returns:
- Whether the given bounding box is contained
-
intersects
Returns whether the given bounding box is intersecting this bounding box (at least one point in).- Parameters:
b
- The bounding box- Returns:
- Whether the given bounding box is intersected
-
contains
Returns whether the given vector is contained in this bounding box.- Parameters:
v
- The vector- Returns:
- Whether the vector is contained or not.
-
contains
public boolean contains(double x, double y, double z) Returns whether the given position [xyz] is contained in this bounding box.- Parameters:
x
- The x componenty
- The y componentz
- The z component- Returns:
- Whether it is contained in this box
-
toString
-
ext
Extends the bounding box by the given vector.- Parameters:
x
- The x-coordinatey
- The y-coordinatez
- The z-coordinate- Returns:
- This bounding box for chaining.
-
getCenter(Vector3d)