public class AxisAlignedBB
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
double |
maxX
The maximum X coordinate of this bounding box.
|
double |
maxY
The maximum Y coordinate of this bounding box.
|
double |
maxZ
The maximum Z coordinate of this bounding box.
|
double |
minX
The minimum X coordinate of this bounding box.
|
double |
minY
The minimum Y coordinate of this bounding box.
|
double |
minZ
The minimum Y coordinate of this bounding box.
|
Constructor and Description |
---|
AxisAlignedBB(BlockPos pos) |
AxisAlignedBB(BlockPos pos1,
BlockPos pos2) |
AxisAlignedBB(double x1,
double y1,
double z1,
double x2,
double y2,
double z2) |
AxisAlignedBB(Vec3d min,
Vec3d max) |
Modifier and Type | Method and Description |
---|---|
RayTraceResult |
calculateIntercept(Vec3d vecA,
Vec3d vecB) |
double |
calculateXOffset(AxisAlignedBB other,
double offsetX)
if instance and the argument bounding boxes overlap in the Y and Z dimensions, calculate the offset between them
in the X dimension.
|
double |
calculateYOffset(AxisAlignedBB other,
double offsetY)
if instance and the argument bounding boxes overlap in the X and Z dimensions, calculate the offset between them
in the Y dimension.
|
double |
calculateZOffset(AxisAlignedBB other,
double offsetZ)
if instance and the argument bounding boxes overlap in the Y and X dimensions, calculate the offset between them
in the Z dimension.
|
boolean |
contains(Vec3d vec)
Returns if the supplied Vec3D is completely inside the bounding box
|
AxisAlignedBB |
contract(double x,
double y,
double z)
Creates a new
AxisAlignedBB that has been contracted by the given amount, with positive changes
decreasing max values and negative changes increasing min values. |
boolean |
equals(java.lang.Object p_equals_1_) |
AxisAlignedBB |
expand(double x,
double y,
double z)
Creates a new
AxisAlignedBB that has been expanded by the given amount, with positive changes increasing
max values and negative changes decreasing min values. |
double |
getAverageEdgeLength()
Returns the average length of the edges of the bounding box.
|
Vec3d |
getCenter() |
AxisAlignedBB |
grow(double value)
Creates a new
AxisAlignedBB that is expanded by the given value in all directions. |
AxisAlignedBB |
grow(double x,
double y,
double z)
Creates a new
AxisAlignedBB that has been contracted by the given amount in both directions. |
int |
hashCode() |
boolean |
hasNaN() |
AxisAlignedBB |
intersect(AxisAlignedBB other) |
boolean |
intersects(AxisAlignedBB other)
Checks if the bounding box intersects with another.
|
boolean |
intersects(double x1,
double y1,
double z1,
double x2,
double y2,
double z2) |
boolean |
intersects(Vec3d min,
Vec3d max) |
boolean |
intersectsWithXY(Vec3d vec) |
boolean |
intersectsWithXZ(Vec3d vec) |
boolean |
intersectsWithYZ(Vec3d vec) |
AxisAlignedBB |
offset(BlockPos pos) |
AxisAlignedBB |
offset(double x,
double y,
double z)
Offsets the current bounding box by the specified amount.
|
AxisAlignedBB |
offset(Vec3d vec) |
AxisAlignedBB |
setMaxY(double y2)
Helper method that returns a new
AxisAlignedBB with the given value for maxY and all other
values taken from this bounding box. |
AxisAlignedBB |
shrink(double value)
Creates a new
AxisAlignedBB that is expanded by the given value in all directions. |
java.lang.String |
toString() |
AxisAlignedBB |
union(AxisAlignedBB other) |
public final double minX
maxX
.public final double minY
maxY
.public final double minZ
maxZ
.public final double maxX
minX
.public final double maxY
minY
.public final double maxZ
minZ
.public AxisAlignedBB(double x1, double y1, double z1, double x2, double y2, double z2)
public AxisAlignedBB(BlockPos pos)
public AxisAlignedBB setMaxY(double y2)
AxisAlignedBB
with the given value for maxY
and all other
values taken from this bounding box.public boolean equals(java.lang.Object p_equals_1_)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public AxisAlignedBB contract(double x, double y, double z)
AxisAlignedBB
that has been contracted by the given amount, with positive changes
decreasing max values and negative changes increasing min values.
Input | Result |
---|---|
| box[0.0, 0.0, 0.0 -> 2.0, 2.0, 2.0] |
| box[2.0, 2.0, 2.0 -> 4.0, 4.0, 4.0] |
| box[5.0, 5.0, 6.0 -> 7.0, 6.0, 7.0] |
| box[-8.0, 2.0, -2.0 -> -2.0, 8.0, 2.0] |
expand(double, double, double)
- like this, except for expanding.grow(double, double, double)
and grow(double)
- expands in all directions.shrink(double)
- contracts in all directions (like grow(double)
)public AxisAlignedBB expand(double x, double y, double z)
AxisAlignedBB
that has been expanded by the given amount, with positive changes increasing
max values and negative changes decreasing min values.
Input | Result | |
---|---|---|
| box[0, 0, 0 -> 3, 3, 3] | |
| box[-2, -2, -2 -> 1, 1, 1] | |
| box[5, 5, 4, 7, 8, 7] |
contract(double, double, double)
- like this, except for shrinking.grow(double, double, double)
and grow(double)
- expands in all directions.shrink(double)
- contracts in all directions (like grow(double)
)public AxisAlignedBB grow(double x, double y, double z)
AxisAlignedBB
that has been contracted by the given amount in both directions. Negative
values will shrink the AABB instead of expanding it.
Input | Result |
---|---|
| box[-2.0, - 2.0, -2.0 -> 3.0, 3.0, 3.0] |
| box[2.0, 2.0, 2.0 -> 4.0, 4.0, 4.0] |
| box[5.0, 4.0, 6.0 -> 7.0, 8.0, 6.0] |
| box[-1.0, 1.0, 0.0 -> 5.0, 3.0, 4.0] |
expand(double, double, double)
- expands in only one direction.contract(double, double, double)
- contracts in only one direction.grow(double)
- version of this that expands in all directions from one parameter.
shrink(double)
- contracts in all directionspublic AxisAlignedBB grow(double value)
AxisAlignedBB
that is expanded by the given value in all directions. Equivalent to grow(double, double, double)
with the given value for all 3 params. Negative values will shrink the AABB.
grow(double, double, double)
).public AxisAlignedBB intersect(AxisAlignedBB other)
public AxisAlignedBB union(AxisAlignedBB other)
public AxisAlignedBB offset(double x, double y, double z)
public AxisAlignedBB offset(BlockPos pos)
public AxisAlignedBB offset(Vec3d vec)
public double calculateXOffset(AxisAlignedBB other, double offsetX)
public double calculateYOffset(AxisAlignedBB other, double offsetY)
public double calculateZOffset(AxisAlignedBB other, double offsetZ)
public boolean intersects(AxisAlignedBB other)
public boolean intersects(double x1, double y1, double z1, double x2, double y2, double z2)
public boolean contains(Vec3d vec)
public double getAverageEdgeLength()
public AxisAlignedBB shrink(double value)
AxisAlignedBB
that is expanded by the given value in all directions. Equivalent to grow(double)
with value set to the negative of the value provided here. Passing a negative value to this method
values will grow the AABB.
grow(double, double, double)
).public RayTraceResult calculateIntercept(Vec3d vecA, Vec3d vecB)
public boolean intersectsWithYZ(Vec3d vec)
public boolean intersectsWithXZ(Vec3d vec)
public boolean intersectsWithXY(Vec3d vec)
public java.lang.String toString()
toString
in class java.lang.Object
public boolean hasNaN()
public Vec3d getCenter()