Class PVolumesBD
Functions over volumes.
These functions operate using the concepts of minimum-x, maximum-x, minimum-y, maximum-y, minimum-z, maximum-z, edges. It is up to individual applications to assign meaning to these edges such as "left" for minimum-x, "top" for minimum-y, or "far" for minimum-z.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <S,
T> PVolumeBD<T> Brand a given volume as belonging to a different coordinate space.static <S> PVolumeBD<S>
containing
(PVolumeBD<S> a, PVolumeBD<S> b) Construct a volume that will contain botha
andb
.static <S> boolean
Determine whether or not one volume contains another.static <S> boolean
containsPoint
(PVolumeBD<S> a, BigDecimal x, BigDecimal y, BigDecimal z) Determine whether or not a volume contains a given point.static <S> boolean
couldFitInside
(PVolumeBD<S> a, PVolumeBD<S> b) Determine whether or not one volume could fit inside another.static <S> PVolumeBD<S>
create
(BigDecimal x, BigDecimal y, BigDecimal z, BigDecimal size_x, BigDecimal size_y, BigDecimal size_z) Create a volume of size (size_x
,size_y
,size_z
) placing the minimum corner at(x, y, z)
.static <S> PVolumeBD<S>
moveAbsolute
(PVolumeBD<S> volume, BigDecimal x, BigDecimal y, BigDecimal z) Move the given volume to(x, y, z)
.static <S> PVolumeBD<S>
moveRelative
(PVolumeBD<S> volume, BigDecimal x, BigDecimal y, BigDecimal z) Move the given volume by(x, y, z)
.static <S> PVolumeBD<S>
moveRelativeClamped
(PVolumeBD<S> container, PVolumeBD<S> volume, BigDecimal x, BigDecimal y, BigDecimal z) Move the given volume by(x, y, z)
, without allowingvolume
to leavecontainer
.static <S> PVolumeBD<S>
moveRelativeClampedX
(PVolumeBD<S> container, PVolumeBD<S> volume, BigDecimal x) Move the given volume byx
, without allowingvolume
to leavecontainer
.static <S> PVolumeBD<S>
moveRelativeClampedY
(PVolumeBD<S> container, PVolumeBD<S> volume, BigDecimal y) Move the given volume byy
, without allowingvolume
to leavecontainer
.static <S> PVolumeBD<S>
moveRelativeClampedZ
(PVolumeBD<S> container, PVolumeBD<S> volume, BigDecimal z) Move the given volume byz
, without allowingvolume
to leavecontainer
.static <S> PVolumeBD<S>
moveToOrigin
(PVolumeBD<S> volume) Move the given volume to(0, 0, 0)
.static <S> boolean
Determine whether or not two volumes overlap.static <S> String
static <S> String
showToBuilder
(PVolumeBD<S> volume, StringBuilder sb) static <S> PVolumeSizeBD<S>
static <S> PVolumeXYZSplitBD<S,
PVolumeBD<S>> splitAtXYZ
(PVolumeBD<S> v, BigDecimal x, BigDecimal y, BigDecimal z) Split the given volume at point(x, y, z)
.
-
Method Details
-
create
public static <S> PVolumeBD<S> create(BigDecimal x, BigDecimal y, BigDecimal z, BigDecimal size_x, BigDecimal size_y, BigDecimal size_z) Create a volume of size (size_x
,size_y
,size_z
) placing the minimum corner at(x, y, z)
.- Type Parameters:
S
- The coordinate space of the volume- Parameters:
x
- The X value of the minimum cornery
- The Y value of the minimum cornerz
- The Z value of the minimum cornersize_x
- The size of the volume on the X axissize_y
- The size of the volume on the Y axissize_z
- The size of the volume on the Z axis- Returns:
- A volume
-
contains
Determine whether or not one volume contains another.
Containing is reflexive:
contains(a, a) == true
.Containing is transitive:
contains(a, b) → contains(b, c) → contains(a, c)
.Containing is not necessarily symmetric.
- Type Parameters:
S
- The coordinate space of the volumes- Parameters:
a
- Volume Ab
- Volume B- Returns:
true
iffa
containsb
-
moveRelative
public static <S> PVolumeBD<S> moveRelative(PVolumeBD<S> volume, BigDecimal x, BigDecimal y, BigDecimal z) Move the given volume by(x, y, z)
.- Type Parameters:
S
- The coordinate space of the volume- Parameters:
volume
- The volumex
- The amount to move on the X axisy
- The amount to move on the Y axisz
- The amount to move on the Z axis- Returns:
- A moved volume
-
moveRelativeClampedX
public static <S> PVolumeBD<S> moveRelativeClampedX(PVolumeBD<S> container, PVolumeBD<S> volume, BigDecimal x) Move the given volume byx
, without allowingvolume
to leavecontainer
.- Type Parameters:
S
- The coordinate space of the volume- Parameters:
container
- The container volumevolume
- The volumex
- The amount to move on the X axis- Returns:
- A moved volume
- Since:
- 3.0.0
-
moveRelativeClampedY
public static <S> PVolumeBD<S> moveRelativeClampedY(PVolumeBD<S> container, PVolumeBD<S> volume, BigDecimal y) Move the given volume byy
, without allowingvolume
to leavecontainer
.- Type Parameters:
S
- The coordinate space of the volume- Parameters:
container
- The container volumevolume
- The volumey
- The amount to move on the Y axis- Returns:
- A moved volume
- Since:
- 3.0.0
-
moveRelativeClampedZ
public static <S> PVolumeBD<S> moveRelativeClampedZ(PVolumeBD<S> container, PVolumeBD<S> volume, BigDecimal z) Move the given volume byz
, without allowingvolume
to leavecontainer
.- Type Parameters:
S
- The coordinate space of the volume- Parameters:
container
- The container volumevolume
- The volumez
- The amount to move on the Z axis- Returns:
- A moved volume
- Since:
- 3.0.0
-
moveRelativeClamped
public static <S> PVolumeBD<S> moveRelativeClamped(PVolumeBD<S> container, PVolumeBD<S> volume, BigDecimal x, BigDecimal y, BigDecimal z) Move the given volume by(x, y, z)
, without allowingvolume
to leavecontainer
.- Type Parameters:
S
- The coordinate space of the volume- Parameters:
container
- The container volumevolume
- The volumex
- The amount to move on the X axisy
- The amount to move on the Y axisz
- The amount to move on the Z axis- Returns:
- A moved volume
- Since:
- 3.0.0
-
moveAbsolute
public static <S> PVolumeBD<S> moveAbsolute(PVolumeBD<S> volume, BigDecimal x, BigDecimal y, BigDecimal z) Move the given volume to(x, y, z)
.- Type Parameters:
S
- The coordinate space of the volume- Parameters:
volume
- The volumex
- The position to which to move on the X axisy
- The position to which to move on the Y axisz
- The position to which to move on the Z axis- Returns:
- A moved volume
-
moveToOrigin
Move the given volume to(0, 0, 0)
.- Type Parameters:
S
- The coordinate space of the volume- Parameters:
volume
- The volume- Returns:
- A moved volume
-
cast
Brand a given volume as belonging to a different coordinate space. Mixing up coordinate spaces is a common source of difficult-to-locate bugs. Use at your own risk.- Type Parameters:
S
- The starting coordinate spaceT
- The resulting coordinate space- Parameters:
volume
- A volume- Returns:
volume
-
overlaps
Determine whether or not two volumes overlap.
Overlapping is reflexive:
overlaps(a, a) == true
.Overlapping is symmetric:
overlaps(a, b) == overlaps(b, a)
.Overlapping is not necessarily transitive.
- Type Parameters:
S
- The coordinate space of the volumes- Parameters:
a
- A volumeb
- A volume- Returns:
true
iffa
overlapsb
-
couldFitInside
Determine whether or not one volume could fit inside another.
Fitting is reflexive:
couldFitInside(a, a) == true
.Fitting is transitive:
couldFitInside(a, b) → couldFitInside(b, c) → couldFitInside(a, c)
.Fitting is not necessarily symmetric.
- Type Parameters:
S
- The coordinate space of the volumes- Parameters:
a
- A volumeb
- A volume- Returns:
true
iffa
could fit insideb
-
containing
Construct a volume that will contain botha
andb
.- Type Parameters:
S
- The coordinate space of the volumes- Parameters:
a
- A volumeb
- A volume- Returns:
- A volume containing
a
andb
-
containsPoint
Determine whether or not a volume contains a given point.
- Type Parameters:
S
- The coordinate space of the volume- Parameters:
a
- A volumex
- The X coordinate of the pointy
- The Y coordinate of the pointz
- The Z coordinate of the point- Returns:
true
iffa
contains(x, y, z)
-
splitAtXYZ
public static <S> PVolumeXYZSplitBD<S,PVolumeBD<S>> splitAtXYZ(PVolumeBD<S> v, BigDecimal x, BigDecimal y, BigDecimal z) Split the given volume at point
(x, y, z)
.- Type Parameters:
S
- The coordinate space of the volume- Parameters:
v
- A volumex
- The X coordinate of the pointy
- The Y coordinate of the pointz
- The Z coordinate of the point- Returns:
true
iffa
contains(x, y, z)
-
show
- Type Parameters:
S
- The coordinate space of the volume- Parameters:
volume
- The volume- Returns:
- A terse string describing the position and size of the volume
-
size
- Type Parameters:
S
- The coordinate space of the volume- Parameters:
volume
- The volume- Returns:
- The size of the volume
-
showToBuilder
- Type Parameters:
S
- The coordinate space of the volume- Parameters:
volume
- The volumesb
- A string builder- Returns:
- A terse string describing the position and size of the volume
-