Class PAreasBD
Functions over areas.
These functions operate using the concepts of minimum-x, maximum-x, minimum-y, and maximum-y edges. It is up to individual applications to assign meaning to these edges such as "left" for minimum-x and "top" for minimum-y.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <S> PAreaBD<S>
alignCenter
(PAreaBD<S> outer, PAreaBD<S> inner) Align the areainner
such that the center of the area is equal to the center ofouter
.static <S> PAreaBD<S>
alignHorizontallyCenter
(PAreaBD<S> outer, PAreaBD<S> inner) Deprecated.static <S> PAreaBD<S>
alignHorizontallyMaxX
(PAreaBD<S> outer, PAreaBD<S> inner) Deprecated.static <S> PAreaBD<S>
alignHorizontallyMaxXOffset
(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset) Deprecated.static <S> PAreaBD<S>
alignHorizontallyMinX
(PAreaBD<S> outer, PAreaBD<S> inner) Deprecated.static <S> PAreaBD<S>
alignHorizontallyMinXOffset
(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset) Deprecated.static <S> PAreaBD<S>
alignMaxYMaxX
(PAreaBD<S> outer, PAreaBD<S> inner) Equivalent to callingalignMaxYMaxXOffset(PAreaBD, PAreaBD, java.math.BigDecimal, java.math.BigDecimal)
with zero offsets.static <S> PAreaBD<S>
alignMaxYMaxXOffset
(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset_x, BigDecimal offset_y) Align the areainner
such that the maximum-y edge is at leastoffset_y
from the inside maximum-y edge ofouter
and the maximum-x edge is at leastoffset_x
from the inside maximum-x edge ofouter
.static <S> PAreaBD<S>
alignMaxYMinX
(PAreaBD<S> outer, PAreaBD<S> inner) Equivalent to callingalignMaxYMinXOffset(PAreaBD, PAreaBD, java.math.BigDecimal, java.math.BigDecimal)
with zero offsets.static <S> PAreaBD<S>
alignMaxYMinXOffset
(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset_x, BigDecimal offset_y) Align the areainner
such that the maximum-y edge is at leastoffset_y
from the inside maximum-y edge ofouter
and the minimum-x edge is at leastoffset_x
from the inside minimum-x edge ofouter
.static <S> PAreaBD<S>
alignMinYMaxX
(PAreaBD<S> outer, PAreaBD<S> inner) Equivalent to callingalignMinYMaxXOffset(PAreaBD, PAreaBD, java.math.BigDecimal, java.math.BigDecimal)
with zero offsets.static <S> PAreaBD<S>
alignMinYMaxXOffset
(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset_x, BigDecimal offset_y) Align the areainner
such that the minimum-y edge is at leastoffset_y
from the inside minimum-y edge ofouter
and the maximum-x edge is at leastoffset_x
from the inside maximum-x edge ofouter
.static <S> PAreaBD<S>
alignMinYMinX
(PAreaBD<S> outer, PAreaBD<S> inner) Equivalent to callingalignMinYMinXOffset(PAreaBD, PAreaBD, java.math.BigDecimal, java.math.BigDecimal)
with zero offsets.static <S> PAreaBD<S>
alignMinYMinXOffset
(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset_x, BigDecimal offset_y) Align the areainner
such that the minimum-y edge is at leastoffset_y
from the inside minimum-y edge ofouter
and the minimum-x edge is at leastoffset_x
from the inside minimum-x edge ofouter
.static <S> PAreaBD<S>
alignOnXCenter
(PAreaBD<S> outer, PAreaBD<S> inner) Align the areainner
along the X axis in the center ofouter
.static <S> PAreaBD<S>
alignOnXMaxX
(PAreaBD<S> outer, PAreaBD<S> inner) Equivalent to callingalignOnXMaxXOffset(PAreaBD, PAreaBD, java.math.BigDecimal)
with a zero offset.static <S> PAreaBD<S>
alignOnXMaxXOffset
(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset) Align the areainner
along the X axis against the inside maximum-x edge ofouter
.static <S> PAreaBD<S>
alignOnXMinX
(PAreaBD<S> outer, PAreaBD<S> inner) Equivalent to callingalignOnXMinXOffset(PAreaBD, PAreaBD, java.math.BigDecimal)
with a zero offset.static <S> PAreaBD<S>
alignOnXMinXOffset
(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset) Align the areainner
along the X axis against the inside minimum-x edge ofouter
.static <S> PAreaBD<S>
alignOnYCenter
(PAreaBD<S> outer, PAreaBD<S> inner) Align the areainner
along the Y axis in the center ofouter
.static <S> PAreaBD<S>
alignOnYMaxY
(PAreaBD<S> outer, PAreaBD<S> inner) Equivalent to callingalignOnYMaxYOffset(PAreaBD, PAreaBD, java.math.BigDecimal)
with a zero offset.static <S> PAreaBD<S>
alignOnYMaxYOffset
(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset) Align the areainner
along the Y axis against the inside maximum-y edge ofouter
.static <S> PAreaBD<S>
alignOnYMinY
(PAreaBD<S> outer, PAreaBD<S> inner) Equivalent to callingalignOnYMinYOffset(PAreaBD, PAreaBD, java.math.BigDecimal)
with a zero offset.static <S> PAreaBD<S>
alignOnYMinYOffset
(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset) Align the areainner
along the Y axis against the inside minimum-y edge ofouter
.static <S> PAreaBD<S>
alignVerticallyCenter
(PAreaBD<S> outer, PAreaBD<S> inner) Deprecated.static <S> PAreaBD<S>
alignVerticallyMaxY
(PAreaBD<S> outer, PAreaBD<S> inner) Deprecated.static <S> PAreaBD<S>
alignVerticallyMaxYOffset
(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset) Deprecated.static <S> PAreaBD<S>
alignVerticallyMinY
(PAreaBD<S> outer, PAreaBD<S> inner) Deprecated.static <S> PAreaBD<S>
alignVerticallyMinYOffset
(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset) Deprecated.static <S,
T> PAreaBD<T> Brand a given area as belonging to a different coordinate space.static <S> PAreaBD<S>
containing
(PAreaBD<S> a, PAreaBD<S> b) Construct a area that will contain botha
andb
.static <S> boolean
Determine whether or not one area contains another.static <S> boolean
containsPoint
(PAreaBD<S> a, BigDecimal x, BigDecimal y) Determine whether or not a area contains a given point.static <S> boolean
couldFitInside
(PAreaBD<S> a, PAreaBD<S> b) Determine whether or not one area could fit inside another.static <S> PAreaBD<S>
create
(BigDecimal x, BigDecimal y, BigDecimal size_x, BigDecimal size_y) Create an area of sizesize_x
on the X axis and sizesize_y
on the Y axis, placing the minimum corner at(x, y)
.static <S> PAreaBD<S>
fitBetweenHorizontal
(PAreaBD<S> fit, PAreaBD<S> a, PAreaBD<S> b) Deprecated.static <S> PAreaBD<S>
fitBetweenOnX
(PAreaBD<S> fit, PAreaBD<S> a, PAreaBD<S> b) Attempt to fitfit
betweena
andb
, horizontally.static <S> PAreaBD<S>
fitBetweenOnY
(PAreaBD<S> fit, PAreaBD<S> a, PAreaBD<S> b) Attempt to fitfit
betweena
andb
, vertically.static <S> PAreaBD<S>
fitBetweenVertical
(PAreaBD<S> fit, PAreaBD<S> a, PAreaBD<S> b) Deprecated.static <S> PAreaBD<S>
hollowOut
(PAreaBD<S> outer, BigDecimal min_x_offset, BigDecimal max_x_offset, BigDecimal min_y_offset, BigDecimal max_y_offset) Construct a new area that fits insideouter
based on the given offsets from each edge.static <S> PAreaBD<S>
hollowOutEvenly
(PAreaBD<S> outer, BigDecimal offset) Equivalent to callinghollowOut(PAreaBD, java.math.BigDecimal, java.math.BigDecimal, java.math.BigDecimal, java.math.BigDecimal)
withoffset
for all offset parameters.static <S> PAreaBD<S>
moveAbsolute
(PAreaBD<S> area, BigDecimal x, BigDecimal y) Move the given area to(x, y)
.static <S> PAreaBD<S>
moveRelative
(PAreaBD<S> area, BigDecimal x, BigDecimal y) Move the given area by(x, y)
.static <S> PAreaBD<S>
moveRelativeClamped
(PAreaBD<S> container, PAreaBD<S> area, BigDecimal x, BigDecimal y) Move the given area by(x, y)
, without allowingarea
to leavecontainer
.static <S> PAreaBD<S>
moveRelativeClampedX
(PAreaBD<S> container, PAreaBD<S> area, BigDecimal x) Move the given area byx
, without allowingarea
to leavecontainer
.static <S> PAreaBD<S>
moveRelativeClampedY
(PAreaBD<S> container, PAreaBD<S> area, BigDecimal y) Move the given area byy
, without allowingarea
to leavecontainer
.static <S> PAreaBD<S>
moveToOrigin
(PAreaBD<S> area) Move the given area to(0, 0)
.static <S> boolean
Determine whether or not two areas overlap.static <S> PAreaBD<S>
scaleFromCenter
(PAreaBD<S> area, BigDecimal x_diff, BigDecimal y_diff) Scalearea
by addingx_diff
to the sizeX, andy_diff
to the sizeY.static <S> PAreaBD<S>
scaleFromMaxYMaxX
(PAreaBD<S> area, BigDecimal x_diff, BigDecimal y_diff) Scalearea
by addingx_diff
to the sizeX, andy_diff
to the sizeY.static <S> PAreaBD<S>
scaleFromMaxYMinX
(PAreaBD<S> area, BigDecimal x_diff, BigDecimal y_diff) Scalearea
by addingx_diff
to the sizeX, andy_diff
to the sizeY.static <S> PAreaBD<S>
scaleFromMinYMaxX
(PAreaBD<S> area, BigDecimal x_diff, BigDecimal y_diff) Scalearea
by addingx_diff
to the sizeX, andy_diff
to the sizeY.static <S> PAreaBD<S>
scaleFromMinYMinX
(PAreaBD<S> area, BigDecimal x_diff, BigDecimal y_diff) Scalearea
by addingx_diff
to the sizeX, andy_diff
to the sizeY.static <S> PAreaBD<S>
setSizeFromCenter
(PAreaBD<S> area, BigDecimal sizeX, BigDecimal sizeY) Set the sizeX and sizeY ofarea
tosizeX
andsizeY
, respectively.static <S> PAreaBD<S>
setSizeFromMaxYMaxX
(PAreaBD<S> area, BigDecimal sizeX, BigDecimal sizeY) Set the sizeX and sizeY ofarea
tosizeX
andsizeY
, respectively.static <S> PAreaBD<S>
setSizeFromMaxYMinX
(PAreaBD<S> area, BigDecimal sizeX, BigDecimal sizeY) Set the sizeX and sizeY ofarea
tosizeX
andsizeY
, respectively.static <S> PAreaBD<S>
setSizeFromMinYMaxX
(PAreaBD<S> area, BigDecimal sizeX, BigDecimal sizeY) Set the sizeX and sizeY ofarea
tosizeX
andsizeY
, respectively.static <S> PAreaBD<S>
setSizeFromMinYMinX
(PAreaBD<S> area, BigDecimal sizeX, BigDecimal sizeY) Set the sizeX and sizeY ofarea
tosizeX
andsizeY
, respectively.static <S> String
static <S> String
showToBuilder
(PAreaBD<S> area, StringBuilder sb) static <S> PAreaSizeBD<S>
static <S> PAreaXSplitBD<S,
PAreaBD<S>> splitAlongParallelToX
(PAreaBD<S> area, BigDecimal y) Splitarea
along a line parallel to the X axis placed aty
units from its own minimum-y edge.static <S> PAreaYSplitBD<S,
PAreaBD<S>> splitAlongParallelToY
(PAreaBD<S> area, BigDecimal x) Splitarea
along a line parallel to the Y axis placed atx
units from its own minimum-x edge.static <S> PAreaXYSplitBD<S,
PAreaBD<S>> splitAlongXY
(PAreaBD<S> area, BigDecimal x, BigDecimal y) Splitarea
along a two axis-aligned perpendicular lines that intercept at(x, y)
.
-
Method Details
-
create
public static <S> PAreaBD<S> create(BigDecimal x, BigDecimal y, BigDecimal size_x, BigDecimal size_y) Create an area of sizesize_x
on the X axis and sizesize_y
on the Y axis, placing the minimum corner at(x, y)
.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
x
- The X value of the minimum cornery
- The Y value of the minimum cornersize_x
- The size of the area on the X axissize_y
- The size of the area on the Y axis- Returns:
- An area
-
contains
Determine whether or not one area 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 areas- Parameters:
a
- Area Ab
- Area B- Returns:
true
iffa
containsb
-
moveRelative
Move the given area by(x, y)
.- Type Parameters:
S
- The coordinate space of the area- Parameters:
area
- The areax
- The amount to move on the X axisy
- The amount to move on the Y axis- Returns:
- A moved area
-
moveRelativeClampedX
public static <S> PAreaBD<S> moveRelativeClampedX(PAreaBD<S> container, PAreaBD<S> area, BigDecimal x) Move the given area byx
, without allowingarea
to leavecontainer
.- Type Parameters:
S
- The coordinate space of the area- Parameters:
container
- The container areaarea
- The areax
- The amount to move on the X axis- Returns:
- A moved area
- Since:
- 3.0.0
-
moveRelativeClampedY
public static <S> PAreaBD<S> moveRelativeClampedY(PAreaBD<S> container, PAreaBD<S> area, BigDecimal y) Move the given area byy
, without allowingarea
to leavecontainer
.- Type Parameters:
S
- The coordinate space of the area- Parameters:
container
- The container areaarea
- The areay
- The amount to move on the Y axis- Returns:
- A moved area
- Since:
- 3.0.0
-
moveRelativeClamped
public static <S> PAreaBD<S> moveRelativeClamped(PAreaBD<S> container, PAreaBD<S> area, BigDecimal x, BigDecimal y) Move the given area by(x, y)
, without allowingarea
to leavecontainer
.- Type Parameters:
S
- The coordinate space of the area- Parameters:
container
- The container areaarea
- The areax
- The amount to move on the X axisy
- The amount to move on the Y axis- Returns:
- A moved area
- Since:
- 3.0.0
-
moveAbsolute
Move the given area to(x, y)
.- Type Parameters:
S
- The coordinate space of the area- Parameters:
area
- The areax
- The position to which to move on the X axisy
- The position to which to move on the Y axis- Returns:
- A moved area
-
moveToOrigin
Move the given area to(0, 0)
.- Type Parameters:
S
- The coordinate space of the area- Parameters:
area
- The area- Returns:
- A moved area
-
cast
Brand a given area 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:
area
- An area- Returns:
area
-
alignHorizontallyCenter
@Deprecated public static <S> PAreaBD<S> alignHorizontallyCenter(PAreaBD<S> outer, PAreaBD<S> inner) Deprecated.Align the areainner
horizontally in the center ofouter
.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
-
alignHorizontallyMinX
Deprecated.Equivalent to callingalignHorizontallyMinXOffset(PAreaBD, PAreaBD, java.math.BigDecimal)
with a zero offset.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
-
alignHorizontallyMinXOffset
@Deprecated public static <S> PAreaBD<S> alignHorizontallyMinXOffset(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset) Deprecated.Align the areainner
horizontally against the inside minimum-x edge ofouter
. The area will be at leastoffset
units from the minimum-x edge.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner areaoffset
- The offset from the edge- Returns:
- An aligned area
-
alignHorizontallyMaxX
Deprecated.Equivalent to callingalignHorizontallyMaxXOffset(PAreaBD, PAreaBD, java.math.BigDecimal)
with a zero offset.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
-
alignHorizontallyMaxXOffset
@Deprecated public static <S> PAreaBD<S> alignHorizontallyMaxXOffset(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset) Deprecated.Align the areainner
horizontally against the inside maximum-x edge ofouter
. The area will be at leastoffset
units from the maximum-x edge.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner areaoffset
- The offset from the edge- Returns:
- An aligned area
-
alignVerticallyMinY
Deprecated.Equivalent to callingalignVerticallyMinYOffset(PAreaBD, PAreaBD, java.math.BigDecimal)
with a zero offset.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
-
alignVerticallyMinYOffset
@Deprecated public static <S> PAreaBD<S> alignVerticallyMinYOffset(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset) Deprecated.Align the areainner
vertically against the inside minimum-y edge ofouter
. The area will be at leastoffset
units from the minimum-y edge.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner areaoffset
- The offset from the edge- Returns:
- An aligned area
-
alignVerticallyMaxY
Deprecated.Equivalent to callingalignVerticallyMaxYOffset(PAreaBD, PAreaBD, java.math.BigDecimal)
with a zero offset.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
-
alignVerticallyMaxYOffset
@Deprecated public static <S> PAreaBD<S> alignVerticallyMaxYOffset(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset) Deprecated.Align the areainner
vertically against the inside maximum-y edge ofouter
. The area will be at leastoffset
units from the maximum-y edge.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner areaoffset
- The offset from the edge- Returns:
- An aligned area
-
alignVerticallyCenter
Deprecated.Align the areainner
vertically in the center ofouter
.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
-
alignOnXCenter
Align the areainner
along the X axis in the center ofouter
.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
- Since:
- 1.1.0
-
alignOnXMinX
Equivalent to callingalignOnXMinXOffset(PAreaBD, PAreaBD, java.math.BigDecimal)
with a zero offset.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
- Since:
- 1.1.0
-
alignOnXMinXOffset
public static <S> PAreaBD<S> alignOnXMinXOffset(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset) Align the areainner
along the X axis against the inside minimum-x edge ofouter
. The area will be at leastoffset
units from the minimum-x edge.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner areaoffset
- The offset from the edge- Returns:
- An aligned area
- Since:
- 1.1.0
-
alignOnXMaxX
Equivalent to callingalignOnXMaxXOffset(PAreaBD, PAreaBD, java.math.BigDecimal)
with a zero offset.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
- Since:
- 1.1.0
-
alignOnXMaxXOffset
public static <S> PAreaBD<S> alignOnXMaxXOffset(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset) Align the areainner
along the X axis against the inside maximum-x edge ofouter
. The area will be at leastoffset
units from the maximum-x edge.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner areaoffset
- The offset from the edge- Returns:
- An aligned area
- Since:
- 1.1.0
-
alignOnYMinY
Equivalent to callingalignOnYMinYOffset(PAreaBD, PAreaBD, java.math.BigDecimal)
with a zero offset.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
- Since:
- 1.1.0
-
alignOnYMinYOffset
public static <S> PAreaBD<S> alignOnYMinYOffset(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset) Align the areainner
along the Y axis against the inside minimum-y edge ofouter
. The area will be at leastoffset
units from the minimum-y edge.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner areaoffset
- The offset from the edge- Returns:
- An aligned area
- Since:
- 1.1.0
-
alignOnYMaxY
Equivalent to callingalignOnYMaxYOffset(PAreaBD, PAreaBD, java.math.BigDecimal)
with a zero offset.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
- Since:
- 1.1.0
-
alignOnYMaxYOffset
public static <S> PAreaBD<S> alignOnYMaxYOffset(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset) Align the areainner
along the Y axis against the inside maximum-y edge ofouter
. The area will be at leastoffset
units from the maximum-y edge.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner areaoffset
- The offset from the edge- Returns:
- An aligned area
- Since:
- 1.1.0
-
alignOnYCenter
Align the areainner
along the Y axis in the center ofouter
.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
- Since:
- 1.1.0
-
alignMinYMinX
Equivalent to callingalignMinYMinXOffset(PAreaBD, PAreaBD, java.math.BigDecimal, java.math.BigDecimal)
with zero offsets.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
-
alignMinYMinXOffset
public static <S> PAreaBD<S> alignMinYMinXOffset(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset_x, BigDecimal offset_y) Align the areainner
such that the minimum-y edge is at leastoffset_y
from the inside minimum-y edge ofouter
and the minimum-x edge is at leastoffset_x
from the inside minimum-x edge ofouter
.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner areaoffset_x
- The offset from the minimum-x edgeoffset_y
- The offset from the minimum-y edge- Returns:
- An aligned area
-
alignMinYMaxX
Equivalent to callingalignMinYMaxXOffset(PAreaBD, PAreaBD, java.math.BigDecimal, java.math.BigDecimal)
with zero offsets.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
-
alignMinYMaxXOffset
public static <S> PAreaBD<S> alignMinYMaxXOffset(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset_x, BigDecimal offset_y) Align the areainner
such that the minimum-y edge is at leastoffset_y
from the inside minimum-y edge ofouter
and the maximum-x edge is at leastoffset_x
from the inside maximum-x edge ofouter
.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner areaoffset_x
- The offset from the maximum-x edgeoffset_y
- The offset from the minimum-y edge- Returns:
- An aligned area
-
alignMaxYMinX
Equivalent to callingalignMaxYMinXOffset(PAreaBD, PAreaBD, java.math.BigDecimal, java.math.BigDecimal)
with zero offsets.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
-
alignMaxYMinXOffset
public static <S> PAreaBD<S> alignMaxYMinXOffset(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset_x, BigDecimal offset_y) Align the areainner
such that the maximum-y edge is at leastoffset_y
from the inside maximum-y edge ofouter
and the minimum-x edge is at leastoffset_x
from the inside minimum-x edge ofouter
.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner areaoffset_x
- The offset from the minimum-x edgeoffset_y
- The offset from the maximum-y edge- Returns:
- An aligned area
-
alignMaxYMaxX
Equivalent to callingalignMaxYMaxXOffset(PAreaBD, PAreaBD, java.math.BigDecimal, java.math.BigDecimal)
with zero offsets.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
-
alignMaxYMaxXOffset
public static <S> PAreaBD<S> alignMaxYMaxXOffset(PAreaBD<S> outer, PAreaBD<S> inner, BigDecimal offset_x, BigDecimal offset_y) Align the areainner
such that the maximum-y edge is at leastoffset_y
from the inside maximum-y edge ofouter
and the maximum-x edge is at leastoffset_x
from the inside maximum-x edge ofouter
.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner areaoffset_x
- The offset from the maximum-x edgeoffset_y
- The offset from the maximum-y edge- Returns:
- An aligned area
-
alignCenter
Align the areainner
such that the center of the area is equal to the center ofouter
.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The outer areainner
- The inner area- Returns:
- An aligned area
-
hollowOut
public static <S> PAreaBD<S> hollowOut(PAreaBD<S> outer, BigDecimal min_x_offset, BigDecimal max_x_offset, BigDecimal min_y_offset, BigDecimal max_y_offset) Construct a new area that fits insideouter
based on the given offsets from each edge.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The containing areamin_x_offset
- The offset from the minimum-x edge (must be non-negative)max_x_offset
- The offset from the maximum-x edge (must be non-negative)min_y_offset
- The offset from the minimum-y edge (must be non-negative)max_y_offset
- The offset from the maximum-y edge (must be non-negative)- Returns:
- A new area
-
hollowOutEvenly
Equivalent to callinghollowOut(PAreaBD, java.math.BigDecimal, java.math.BigDecimal, java.math.BigDecimal, java.math.BigDecimal)
withoffset
for all offset parameters.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
outer
- The containing areaoffset
- The offset from each edge (must be non-negative)- Returns:
- A new area
-
setSizeFromCenter
Set the sizeX and sizeY of
area
tosizeX
andsizeY
, respectively.The area is resized from its own center.
- Type Parameters:
S
- The coordinate space of the area- Parameters:
area
- The areasizeX
- The new sizeX (must be non-negative)sizeY
- The new sizeY (must be non-negative)- Returns:
- A resized area
-
setSizeFromMinYMinX
public static <S> PAreaBD<S> setSizeFromMinYMinX(PAreaBD<S> area, BigDecimal sizeX, BigDecimal sizeY) Set the sizeX and sizeY of
area
tosizeX
andsizeY
, respectively.The area is resized by moving its minimum-y-minimum-x corner.
- Type Parameters:
S
- The coordinate space of the area- Parameters:
area
- The areasizeX
- The new sizeX (must be non-negative)sizeY
- The new sizeY (must be non-negative)- Returns:
- A resized area
-
setSizeFromMinYMaxX
public static <S> PAreaBD<S> setSizeFromMinYMaxX(PAreaBD<S> area, BigDecimal sizeX, BigDecimal sizeY) Set the sizeX and sizeY of
area
tosizeX
andsizeY
, respectively.The area is resized by moving its minimum-y-maximum-x corner.
- Type Parameters:
S
- The coordinate space of the area- Parameters:
area
- The areasizeX
- The new sizeX (must be non-negative)sizeY
- The new sizeY (must be non-negative)- Returns:
- A resized area
-
setSizeFromMaxYMaxX
public static <S> PAreaBD<S> setSizeFromMaxYMaxX(PAreaBD<S> area, BigDecimal sizeX, BigDecimal sizeY) Set the sizeX and sizeY of
area
tosizeX
andsizeY
, respectively.The area is resized by moving its maximum-y-maximum-x corner.
- Type Parameters:
S
- The coordinate space of the area- Parameters:
area
- The areasizeX
- The new sizeX (must be non-negative)sizeY
- The new sizeY (must be non-negative)- Returns:
- A resized area
-
setSizeFromMaxYMinX
public static <S> PAreaBD<S> setSizeFromMaxYMinX(PAreaBD<S> area, BigDecimal sizeX, BigDecimal sizeY) Set the sizeX and sizeY of
area
tosizeX
andsizeY
, respectively.The area is resized by moving its maximum-y-minimum-x corner.
- Type Parameters:
S
- The coordinate space of the area- Parameters:
area
- The areasizeX
- The new sizeX (must be non-negative)sizeY
- The new sizeY (must be non-negative)- Returns:
- A resized area
-
scaleFromMinYMinX
public static <S> PAreaBD<S> scaleFromMinYMinX(PAreaBD<S> area, BigDecimal x_diff, BigDecimal y_diff) Scale
area
by addingx_diff
to the sizeX, andy_diff
to the sizeY. The size of the resulting area is clamped so that its sizeX and sizeY are always non-negative.The area is resized by moving its minimum-y-minimum-x corner.
- Type Parameters:
S
- The coordinate space of the area- Parameters:
area
- The areax_diff
- The X differencey_diff
- The Y difference- Returns:
- A resized area
-
scaleFromMinYMaxX
public static <S> PAreaBD<S> scaleFromMinYMaxX(PAreaBD<S> area, BigDecimal x_diff, BigDecimal y_diff) Scale
area
by addingx_diff
to the sizeX, andy_diff
to the sizeY. The size of the resulting area is clamped so that its sizeX and sizeY are always non-negative.The area is resized by moving its minimum-y-maximum-x corner.
- Type Parameters:
S
- The coordinate space of the area- Parameters:
area
- The areax_diff
- The X differencey_diff
- The Y difference- Returns:
- A resized area
-
scaleFromMaxYMinX
public static <S> PAreaBD<S> scaleFromMaxYMinX(PAreaBD<S> area, BigDecimal x_diff, BigDecimal y_diff) Scale
area
by addingx_diff
to the sizeX, andy_diff
to the sizeY. The size of the resulting area is clamped so that its sizeX and sizeY are always non-negative.The area is resized by moving its maximum-y-minimum-x corner.
- Type Parameters:
S
- The coordinate space of the area- Parameters:
area
- The areax_diff
- The X differencey_diff
- The Y difference- Returns:
- A resized area
-
scaleFromMaxYMaxX
public static <S> PAreaBD<S> scaleFromMaxYMaxX(PAreaBD<S> area, BigDecimal x_diff, BigDecimal y_diff) Scale
area
by addingx_diff
to the sizeX, andy_diff
to the sizeY. The size of the resulting area is clamped so that its sizeX and sizeY are always non-negative.The area is resized by moving its maximum-y-maximum-x corner.
- Type Parameters:
S
- The coordinate space of the area- Parameters:
area
- The areax_diff
- The X differencey_diff
- The Y difference- Returns:
- A resized area
-
scaleFromCenter
Scale
area
by addingx_diff
to the sizeX, andy_diff
to the sizeY. The size of the resulting area is clamped so that its sizeX and sizeY are always non-negative.The area is resized from its own center.
- Type Parameters:
S
- The coordinate space of the area- Parameters:
area
- The areax_diff
- The X differencey_diff
- The Y difference- Returns:
- A resized area
-
overlaps
Determine whether or not two areas 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 areas- Parameters:
a
- An areab
- An area- Returns:
true
iffa
overlapsb
-
couldFitInside
Determine whether or not one area 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 areas- Parameters:
a
- An areab
- An area- Returns:
true
iffa
could fit insideb
-
containing
Construct a area that will contain botha
andb
.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
a
- An areab
- An area- Returns:
- An area containing
a
andb
-
containsPoint
Determine whether or not a area contains a given point.
- Type Parameters:
S
- The coordinate space of the area- Parameters:
a
- An areax
- The X coordinate of the pointy
- The Y coordinate of the point- Returns:
true
iffa
contains(x, y)
-
fitBetweenHorizontal
@Deprecated public static <S> PAreaBD<S> fitBetweenHorizontal(PAreaBD<S> fit, PAreaBD<S> a, PAreaBD<S> b) Deprecated.Attempt to fitfit
betweena
andb
, horizontally.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
fit
- The area to be fitteda
- An areab
- An area- Returns:
- A fitted area
-
fitBetweenVertical
@Deprecated public static <S> PAreaBD<S> fitBetweenVertical(PAreaBD<S> fit, PAreaBD<S> a, PAreaBD<S> b) Deprecated.Attempt to fitfit
betweena
andb
, vertically.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
fit
- The area to be fitteda
- An areab
- An area- Returns:
- A fitted area
-
fitBetweenOnX
Attempt to fitfit
betweena
andb
, horizontally.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
fit
- The area to be fitteda
- An areab
- An area- Returns:
- A fitted area
-
fitBetweenOnY
Attempt to fitfit
betweena
andb
, vertically.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
fit
- The area to be fitteda
- An areab
- An area- Returns:
- A fitted area
-
splitAlongParallelToX
Splitarea
along a line parallel to the X axis placed aty
units from its own minimum-y edge.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
area
- The area to be splity
- The relative Y coordinate of the splitting edge- Returns:
- A pair of areas
-
splitAlongParallelToY
Splitarea
along a line parallel to the Y axis placed atx
units from its own minimum-x edge.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
area
- The area to be splitx
- The relative X coordinate of the splitting edge- Returns:
- A pair of areas
-
splitAlongXY
public static <S> PAreaXYSplitBD<S,PAreaBD<S>> splitAlongXY(PAreaBD<S> area, BigDecimal x, BigDecimal y) Splitarea
along a two axis-aligned perpendicular lines that intercept at(x, y)
.- Type Parameters:
S
- The coordinate space of the areas- Parameters:
area
- The area to be splitx
- The relative X coordinate of the splitting edgey
- The relative Y coordinate of the splitting edge- Returns:
- The four resulting quadrants
- Since:
- 1.1.0
-
show
- Type Parameters:
S
- The coordinate space of the area- Parameters:
area
- The area- Returns:
- A terse string describing the position and size of the area
-
size
- Type Parameters:
S
- The coordinate space of the area- Parameters:
area
- The area- Returns:
- The size of the area
-
showToBuilder
- Type Parameters:
S
- The coordinate space of the area- Parameters:
area
- The areasb
- A string builder- Returns:
- A terse string describing the position and size of the area
-
alignOnXCenter(PAreaBD, PAreaBD)