Class BoundingBox3d
java.lang.Object
dev.ryanhcode.sable.companion.math.BoundingBox3d
- All Implemented Interfaces:
BoundingBox3dc
A bounding box with JOML interaction.
- Since:
- 1.0.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic com.mojang.serialization.Codec<BoundingBox3d> static final BoundingBox3ddoubledoubledoubledoubledoubledouble -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for an all-zero bounding boxBoundingBox3d(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) Creates a new bounding box with the given valuesBoundingBox3d(BoundingBox3dc other) Creates a new bounding box with the given valuesBoundingBox3d(BoundingBox3ic other) Creates a new bounding box with the given valuesBoundingBox3d(net.minecraft.core.BlockPos pos) Creates a new bounding box with the given valuesBoundingBox3d(net.minecraft.world.level.levelgen.structure.BoundingBox other) Creates a new bounding box with the given valuesBoundingBox3d(net.minecraft.world.phys.AABB other) Creates a new bounding box with the given valuesBoundingBox3d(net.minecraft.world.phys.Vec3 from, net.minecraft.world.phys.Vec3 to) Creates a new bounding box with the given values -
Method Summary
Modifier and TypeMethodDescriptionexpand(double amount) Expands this box by the given amount on all sidesexpand(double amountX, double amountY, double amountZ) Expands this box by the given amount on all sidesexpandTo(double x, double y, double z) Expands this box to include the given pointexpandTo(BoundingBox3dc other) Expands this box to include the given boxexpandTo(org.joml.Vector3dc point) Expands this box to include the given pointintersect(BoundingBox3dc box) Calculates the bounding box intersect between this box and the specified box.doublemaxX()doublemaxY()doublemaxZ()doubleminX()doubleminY()doubleminZ()move(double amountX, double amountY, double amountZ) Moves this box by the given amount on all sidesset(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) Sets the bounding box to the given values.set(BoundingBox3dc other) Sets the bounding box to the given valuesset(net.minecraft.world.phys.AABB other) Sets the bounding box to the given valuessetUnchecked(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) Sets the bounding box to the given values.setUnchecked(BoundingBox3dc other) Sets the bounding box to the given values.Transforms a bounding box by the given pose, picking the maximum bounds around the transformed corners and storing the result in this bounding box.Transforms a bounding box by the given pose, picking the maximum bounds around the transformed corners and storing the result in this bounding box.transform(org.joml.Matrix4dc mpose) Transforms a bounding box by the given pose, picking the maximum bounds around the transformed corners and storing the result in this bounding box.transformInverse(Pose3dc pose) Transforms a bounding box by the inverse of the given pose, picking the maximum bounds around the transformed corners and storing the result in this bounding box.transformInverse(Pose3dc pose, org.joml.Matrix4d bakedMatrix) Transforms a bounding box by the inverse of the given pose, picking the maximum bounds around the transformed corners and storing the result in this bounding box.transformInverse(org.joml.Matrix4dc mpose) Transforms a bounding box by the inverse of the given pose, picking the maximum bounds around the transformed corners and storing the result in this bounding box.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface dev.ryanhcode.sable.companion.math.BoundingBox3dc
center, center, chunkBoundsFrom, chunkBoundsFrom, contains, contains, expand, expand, expandTo, expandTo, expandTo, height, intersect, intersects, intersects, intersects, length, move, size, size, toMojang, transform, transform, transform, transformInverse, transformInverse, transformInverse, volume, width
-
Field Details
-
EMPTY
-
CODEC
-
minX
public double minX -
minY
public double minY -
minZ
public double minZ -
maxX
public double maxX -
maxY
public double maxY -
maxZ
public double maxZ
-
-
Constructor Details
-
BoundingBox3d
public BoundingBox3d(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) Creates a new bounding box with the given values -
BoundingBox3d
Creates a new bounding box with the given values -
BoundingBox3d
public BoundingBox3d(net.minecraft.world.phys.AABB other) Creates a new bounding box with the given values -
BoundingBox3d
public BoundingBox3d(net.minecraft.world.level.levelgen.structure.BoundingBox other) Creates a new bounding box with the given values -
BoundingBox3d
public BoundingBox3d(net.minecraft.core.BlockPos pos) Creates a new bounding box with the given values -
BoundingBox3d
Creates a new bounding box with the given values -
BoundingBox3d
public BoundingBox3d(net.minecraft.world.phys.Vec3 from, net.minecraft.world.phys.Vec3 to) Creates a new bounding box with the given values -
BoundingBox3d
public BoundingBox3d()Default constructor for an all-zero bounding box
-
-
Method Details
-
set
Sets the bounding box to the given values -
set
@Contract(value="_->this", mutates="this") public BoundingBox3d set(net.minecraft.world.phys.AABB other) Sets the bounding box to the given values -
set
@Contract(value="_,_,_,_,_,_->this", mutates="this") public BoundingBox3d set(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) Sets the bounding box to the given values. Automatically swaps the values to ensure min values are less than max values. -
setUnchecked
@Contract(value="_,_,_,_,_,_->this", mutates="this") public BoundingBox3d setUnchecked(double minX, double minY, double minZ, double maxX, double maxY, double maxZ) Sets the bounding box to the given values.
Does NOT automatically swap mins/maxes if swapped. -
setUnchecked
Sets the bounding box to the given values.
Does NOT automatically swap mins/maxes if swapped. -
expandTo
Expands this box to include the given point- Parameters:
point- the point to include- Returns:
- the result stored in dest
-
expandTo
@Contract(value="_,_,_->this", mutates="this") public BoundingBox3d expandTo(double x, double y, double z) Expands this box to include the given point- Parameters:
x- the x value of the pointy- the y value of the pointz- the z value of the point- Returns:
- this
-
expandTo
Expands this box to include the given box- Parameters:
other- the box to include- Returns:
- this
-
expand
Expands this box by the given amount on all sides- Parameters:
amount- the amount to expand by- Returns:
- this
-
expand
@Contract(value="_,_,_->this", mutates="this") public BoundingBox3d expand(double amountX, double amountY, double amountZ) Expands this box by the given amount on all sides- Parameters:
amountX- the amount to expand by in the xamountY- the amount to expand by in the yamountZ- the amount to expand by in the z- Returns:
- this
-
move
@Contract(value="_,_,_->this", mutates="this") public BoundingBox3d move(double amountX, double amountY, double amountZ) Moves this box by the given amount on all sides- Parameters:
amountX- The amount to move by in the xamountY- The amount to move by in the yamountZ- The amount to move by in the z- Returns:
- this
-
intersect
Calculates the bounding box intersect between this box and the specified box.- Parameters:
box- The box to intersect with- Returns:
- this
-
transform
Transforms a bounding box by the given pose, picking the maximum bounds around the transformed corners and storing the result in this bounding box.- Parameters:
pose- the pose to transform by- Returns:
- this
-
transform
@Contract(value="_,_->this", mutates="this") public BoundingBox3d transform(Pose3dc pose, org.joml.Matrix4d bakedMatrix) Transforms a bounding box by the given pose, picking the maximum bounds around the transformed corners and storing the result in this bounding box.- Parameters:
pose- the pose to transform by- Returns:
- this
-
transform
Transforms a bounding box by the given pose, picking the maximum bounds around the transformed corners and storing the result in this bounding box.- Parameters:
mpose- the pose to transform by- Returns:
- this
-
transformInverse
Transforms a bounding box by the inverse of the given pose, picking the maximum bounds around the transformed corners and storing the result in this bounding box.- Parameters:
pose- the pose to transform by- Returns:
- this
-
transformInverse
@Contract(value="_,_->this", mutates="this") public BoundingBox3d transformInverse(Pose3dc pose, org.joml.Matrix4d bakedMatrix) Transforms a bounding box by the inverse of the given pose, picking the maximum bounds around the transformed corners and storing the result in this bounding box.- Parameters:
pose- the pose to transform by- Returns:
- this
-
transformInverse
@Contract(value="_->this", mutates="this") public BoundingBox3d transformInverse(org.joml.Matrix4dc mpose) Transforms a bounding box by the inverse of the given pose, picking the maximum bounds around the transformed corners and storing the result in this bounding box.- Parameters:
mpose- the pose to transform by- Returns:
- this
-
minX
public double minX()- Specified by:
minXin interfaceBoundingBox3dc- Returns:
- the minimum x value of this box
-
minY
public double minY()- Specified by:
minYin interfaceBoundingBox3dc- Returns:
- the minimum y value of this box
-
minZ
public double minZ()- Specified by:
minZin interfaceBoundingBox3dc- Returns:
- the minimum z value of this box
-
maxX
public double maxX()- Specified by:
maxXin interfaceBoundingBox3dc- Returns:
- the maximum x value of this box
-
maxY
public double maxY()- Specified by:
maxYin interfaceBoundingBox3dc- Returns:
- the maximum y value of this box
-
maxZ
public double maxZ()- Specified by:
maxZin interfaceBoundingBox3dc- Returns:
- the maximum z value of this box
-