public final class AreasBD extends Object
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.
| Modifier and Type | Method and Description |
|---|---|
static AreaBD |
alignCenter(AreaBD outer,
AreaBD inner)
Align the area
inner such that the center of the area is equal to
the center of outer. |
static AreaBD |
alignHorizontallyCenter(AreaBD outer,
AreaBD inner)
Align the area
inner horizontally in the center of outer. |
static AreaBD |
alignHorizontallyMaxX(AreaBD outer,
AreaBD inner)
Equivalent to calling
alignHorizontallyMaxXOffset(AreaBD,
AreaBD, java.math.BigDecimal) with a zero offset. |
static AreaBD |
alignHorizontallyMaxXOffset(AreaBD outer,
AreaBD inner,
BigDecimal offset)
Align the area
inner horizontally against the inside maximum-x edge
of outer. |
static AreaBD |
alignHorizontallyMinX(AreaBD outer,
AreaBD inner)
Equivalent to calling
alignHorizontallyMinXOffset(AreaBD, AreaBD,
java.math.BigDecimal) with a zero offset. |
static AreaBD |
alignHorizontallyMinXOffset(AreaBD outer,
AreaBD inner,
BigDecimal offset)
Align the area
inner horizontally against the inside minimum-x edge
of outer. |
static AreaBD |
alignMaxYMaxX(AreaBD outer,
AreaBD inner)
Equivalent to calling
alignMaxYMaxXOffset(AreaBD, AreaBD,
java.math.BigDecimal, java.math.BigDecimal) with zero offsets. |
static AreaBD |
alignMaxYMaxXOffset(AreaBD outer,
AreaBD inner,
BigDecimal offset_x,
BigDecimal offset_y)
Align the area
inner such that the maximum-y edge is at least
offset_y from the inside maximum-y edge of outer and the
maximum-x edge is at least offset_x from the inside maximum-x edge
of outer. |
static AreaBD |
alignMaxYMinX(AreaBD outer,
AreaBD inner)
Equivalent to calling
alignMaxYMinXOffset(AreaBD, AreaBD,
java.math.BigDecimal, java.math.BigDecimal) with zero offsets. |
static AreaBD |
alignMaxYMinXOffset(AreaBD outer,
AreaBD inner,
BigDecimal offset_x,
BigDecimal offset_y)
Align the area
inner such that the maximum-y edge is at least
offset_y from the inside maximum-y edge of outer and the
minimum-x edge is at least offset_x from the inside minimum-x edge
of outer. |
static AreaBD |
alignMinYMaxX(AreaBD outer,
AreaBD inner)
Equivalent to calling
alignMinYMaxXOffset(AreaBD, AreaBD,
java.math.BigDecimal, java.math.BigDecimal) with zero offsets. |
static AreaBD |
alignMinYMaxXOffset(AreaBD outer,
AreaBD inner,
BigDecimal offset_x,
BigDecimal offset_y)
Align the area
inner such that the minimum-y edge is at least
offset_y from the inside minimum-y edge of outer and the
maximum-x edge is at least offset_x from the inside maximum-x edge
of outer. |
static AreaBD |
alignMinYMinX(AreaBD outer,
AreaBD inner)
Equivalent to calling
alignMinYMinXOffset(AreaBD, AreaBD,
java.math.BigDecimal, java.math.BigDecimal) with zero offsets. |
static AreaBD |
alignMinYMinXOffset(AreaBD outer,
AreaBD inner,
BigDecimal offset_x,
BigDecimal offset_y)
Align the area
inner such that the minimum-y edge is at least
offset_y from the inside minimum-y edge of outer and the
minimum-x edge is at least offset_x from the inside minimum-x edge
of outer. |
static AreaBD |
alignVerticallyCenter(AreaBD outer,
AreaBD inner)
Align the area
inner vertically in the center of outer. |
static AreaBD |
alignVerticallyMaxY(AreaBD outer,
AreaBD inner)
Equivalent to calling
alignVerticallyMaxYOffset(AreaBD, AreaBD,
java.math.BigDecimal) with a zero offset. |
static AreaBD |
alignVerticallyMaxYOffset(AreaBD outer,
AreaBD inner,
BigDecimal offset)
Align the area
inner vertically against the inside maximum-y edge
of outer. |
static AreaBD |
alignVerticallyMinY(AreaBD outer,
AreaBD inner)
Equivalent to calling
alignVerticallyMinYOffset(AreaBD, AreaBD,
java.math.BigDecimal) with a zero offset. |
static AreaBD |
alignVerticallyMinYOffset(AreaBD outer,
AreaBD inner,
BigDecimal offset)
Align the area
inner vertically against the inside minimum-y edge
of outer. |
static AreaBD |
containing(AreaBD a,
AreaBD b)
Construct a area that will contain both
a and b. |
static boolean |
contains(AreaBD a,
AreaBD b)
Determine whether or not one area contains another.
|
static boolean |
containsPoint(AreaBD a,
BigDecimal x,
BigDecimal y)
Determine whether or not a area contains a given point.
|
static boolean |
couldFitInside(AreaBD a,
AreaBD b)
Determine whether or not one area could fit inside another.
|
static AreaBD |
create(BigDecimal x,
BigDecimal y,
BigDecimal width,
BigDecimal height)
Create an area of width
width and height height, placing
the minimum corner at (x, y). |
static AreaBD |
fitBetweenHorizontal(AreaBD fit,
AreaBD a,
AreaBD b)
Attempt to fit
fit between a and b, horizontally. |
static AreaBD |
fitBetweenVertical(AreaBD fit,
AreaBD a,
AreaBD b)
Attempt to fit
fit between a and b, vertically. |
static AreaBD |
hollowOut(AreaBD outer,
BigDecimal min_x_offset,
BigDecimal max_x_offset,
BigDecimal min_y_offset,
BigDecimal max_y_offset)
Construct a new area that fits inside
outer based on the given
offsets from each edge. |
static AreaBD |
hollowOutEvenly(AreaBD outer,
BigDecimal offset)
Equivalent to calling
hollowOut(AreaBD, java.math.BigDecimal, java.math.BigDecimal,
java.math.BigDecimal, java.math.BigDecimal) with offset for all offset parameters. |
static AreaBD |
moveAbsolute(AreaBD area,
BigDecimal x,
BigDecimal y)
Move the given area to
(x, y). |
static AreaBD |
moveRelative(AreaBD area,
BigDecimal x,
BigDecimal y)
Move the given area by
(x, y). |
static AreaBD |
moveToOrigin(AreaBD area)
Move the given area to
(0, 0). |
static boolean |
overlaps(AreaBD a,
AreaBD b)
Determine whether or not two areas overlap.
|
static AreaBD |
scaleFromCenter(AreaBD area,
BigDecimal x_diff,
BigDecimal y_diff)
Scale
area by adding x_diff to the width, and y_diff to the height. |
static AreaBD |
scaleFromMaxYMaxX(AreaBD area,
BigDecimal x_diff,
BigDecimal y_diff)
Scale
area by adding x_diff to the width, and y_diff to the height. |
static AreaBD |
scaleFromMaxYMinX(AreaBD area,
BigDecimal x_diff,
BigDecimal y_diff)
Scale
area by adding x_diff to the width, and y_diff to the height. |
static AreaBD |
scaleFromMinYMaxX(AreaBD area,
BigDecimal x_diff,
BigDecimal y_diff)
Scale
area by adding x_diff to the width, and y_diff to the height. |
static AreaBD |
scaleFromMinYMinX(AreaBD area,
BigDecimal x_diff,
BigDecimal y_diff)
Scale
area by adding x_diff to the width, and y_diff to the height. |
static AreaBD |
setSizeFromCenter(AreaBD area,
BigDecimal width,
BigDecimal height)
Set the width and height of
area to width and height, respectively. |
static AreaBD |
setSizeFromMaxYMaxX(AreaBD area,
BigDecimal width,
BigDecimal height)
Set the width and height of
area to width and height, respectively. |
static AreaBD |
setSizeFromMaxYMinX(AreaBD area,
BigDecimal width,
BigDecimal height)
Set the width and height of
area to width and height, respectively. |
static AreaBD |
setSizeFromMinYMaxX(AreaBD area,
BigDecimal width,
BigDecimal height)
Set the width and height of
area to width and height, respectively. |
static AreaBD |
setSizeFromMinYMinX(AreaBD area,
BigDecimal width,
BigDecimal height)
Set the width and height of
area to width and height, respectively. |
static String |
show(AreaBD area) |
static String |
showToBuilder(AreaBD area,
StringBuilder sb) |
static AreaSizeBD |
size(AreaBD area) |
static AreaXSplitBD<AreaBD> |
splitAlongParallelToX(AreaBD area,
BigDecimal y)
Split
area along a line parallel to the X axis placed at
y units from its own minimum-y edge. |
static AreaYSplitBD<AreaBD> |
splitAlongParallelToY(AreaBD area,
BigDecimal x)
Split
area along a line parallel to the Y axis placed at
x units from its own minimum-x edge. |
public static AreaBD create(BigDecimal x, BigDecimal y, BigDecimal width, BigDecimal height)
width and height height, placing
the minimum corner at (x, y).x - The X value of the minimum cornery - The Y value of the minimum cornerwidth - The width of the areaheight - The height of the areapublic static boolean contains(AreaBD a, AreaBD b)
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.
a - Area Ab - Area Btrue iff a contains bpublic static AreaBD moveRelative(AreaBD area, BigDecimal x, BigDecimal y)
(x, y).area - The areax - The amount to move on the X axisy - The amount to move on the Y axispublic static AreaBD moveAbsolute(AreaBD area, BigDecimal x, BigDecimal y)
(x, y).area - The areax - The position to which to move on the X axisy - The position to which to move on the Y axispublic static AreaBD moveToOrigin(AreaBD area)
(0, 0).area - The areapublic static AreaBD alignHorizontallyCenter(AreaBD outer, AreaBD inner)
inner horizontally in the center of outer.outer - The outer areainner - The inner areapublic static AreaBD alignHorizontallyMinX(AreaBD outer, AreaBD inner)
alignHorizontallyMinXOffset(AreaBD, AreaBD,
java.math.BigDecimal) with a zero offset.outer - The outer areainner - The inner areapublic static AreaBD alignHorizontallyMinXOffset(AreaBD outer, AreaBD inner, BigDecimal offset)
inner horizontally against the inside minimum-x edge
of outer. The area will be at least offset units from the
minimum-x edge.outer - The outer areainner - The inner areaoffset - The offset from the edge
spublic static AreaBD alignHorizontallyMaxX(AreaBD outer, AreaBD inner)
alignHorizontallyMaxXOffset(AreaBD,
AreaBD, java.math.BigDecimal) with a zero offset.outer - The outer areainner - The inner areapublic static AreaBD alignHorizontallyMaxXOffset(AreaBD outer, AreaBD inner, BigDecimal offset)
inner horizontally against the inside maximum-x edge
of outer. The area will be at least offset units from the
maximum-x edge.outer - The outer areainner - The inner areaoffset - The offset from the edge
spublic static AreaBD alignVerticallyMinY(AreaBD outer, AreaBD inner)
alignVerticallyMinYOffset(AreaBD, AreaBD,
java.math.BigDecimal) with a zero offset.outer - The outer areainner - The inner areapublic static AreaBD alignVerticallyMinYOffset(AreaBD outer, AreaBD inner, BigDecimal offset)
inner vertically against the inside minimum-y edge
of outer. The area will be at least offset units from the
minimum-y edge.outer - The outer areainner - The inner areaoffset - The offset from the edge
spublic static AreaBD alignVerticallyMaxY(AreaBD outer, AreaBD inner)
alignVerticallyMaxYOffset(AreaBD, AreaBD,
java.math.BigDecimal) with a zero offset.outer - The outer areainner - The inner areapublic static AreaBD alignVerticallyMaxYOffset(AreaBD outer, AreaBD inner, BigDecimal offset)
inner vertically against the inside maximum-y edge
of outer. The area will be at least offset units from the
maximum-y edge.outer - The outer areainner - The inner areaoffset - The offset from the edge
spublic static AreaBD alignVerticallyCenter(AreaBD outer, AreaBD inner)
inner vertically in the center of outer.outer - The outer areainner - The inner areapublic static AreaBD alignMinYMinX(AreaBD outer, AreaBD inner)
alignMinYMinXOffset(AreaBD, AreaBD,
java.math.BigDecimal, java.math.BigDecimal) with zero offsets.outer - The outer areainner - The inner areapublic static AreaBD alignMinYMinXOffset(AreaBD outer, AreaBD inner, BigDecimal offset_x, BigDecimal offset_y)
inner such that the minimum-y edge is at least
offset_y from the inside minimum-y edge of outer and the
minimum-x edge is at least offset_x from the inside minimum-x edge
of outer.outer - The outer areainner - The inner areaoffset_x - The offset from the minimum-x edgeoffset_y - The offset from the minimum-y edgepublic static AreaBD alignMinYMaxX(AreaBD outer, AreaBD inner)
alignMinYMaxXOffset(AreaBD, AreaBD,
java.math.BigDecimal, java.math.BigDecimal) with zero offsets.outer - The outer areainner - The inner areapublic static AreaBD alignMinYMaxXOffset(AreaBD outer, AreaBD inner, BigDecimal offset_x, BigDecimal offset_y)
inner such that the minimum-y edge is at least
offset_y from the inside minimum-y edge of outer and the
maximum-x edge is at least offset_x from the inside maximum-x edge
of outer.outer - The outer areainner - The inner areaoffset_x - The offset from the maximum-x edgeoffset_y - The offset from the minimum-y edgepublic static AreaBD alignMaxYMinX(AreaBD outer, AreaBD inner)
alignMaxYMinXOffset(AreaBD, AreaBD,
java.math.BigDecimal, java.math.BigDecimal) with zero offsets.outer - The outer areainner - The inner areapublic static AreaBD alignMaxYMinXOffset(AreaBD outer, AreaBD inner, BigDecimal offset_x, BigDecimal offset_y)
inner such that the maximum-y edge is at least
offset_y from the inside maximum-y edge of outer and the
minimum-x edge is at least offset_x from the inside minimum-x edge
of outer.outer - The outer areainner - The inner areaoffset_x - The offset from the minimum-x edgeoffset_y - The offset from the maximum-y edgepublic static AreaBD alignMaxYMaxX(AreaBD outer, AreaBD inner)
alignMaxYMaxXOffset(AreaBD, AreaBD,
java.math.BigDecimal, java.math.BigDecimal) with zero offsets.outer - The outer areainner - The inner areapublic static AreaBD alignMaxYMaxXOffset(AreaBD outer, AreaBD inner, BigDecimal offset_x, BigDecimal offset_y)
inner such that the maximum-y edge is at least
offset_y from the inside maximum-y edge of outer and the
maximum-x edge is at least offset_x from the inside maximum-x edge
of outer.outer - The outer areainner - The inner areaoffset_x - The offset from the maximum-x edgeoffset_y - The offset from the maximum-y edgepublic static AreaBD alignCenter(AreaBD outer, AreaBD inner)
inner such that the center of the area is equal to
the center of outer.outer - The outer areainner - The inner areapublic static AreaBD hollowOut(AreaBD outer, BigDecimal min_x_offset, BigDecimal max_x_offset, BigDecimal min_y_offset, BigDecimal max_y_offset)
outer based on the given
offsets from each edge.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)public static AreaBD hollowOutEvenly(AreaBD outer, BigDecimal offset)
hollowOut(AreaBD, java.math.BigDecimal, java.math.BigDecimal,
java.math.BigDecimal, java.math.BigDecimal) with offset for all offset parameters.outer - The containing areaoffset - The offset from each edge (must be non-negative)public static AreaBD setSizeFromCenter(AreaBD area, BigDecimal width, BigDecimal height)
Set the width and height of area to width and height, respectively.
The area is resized from its own center.
area - The areawidth - The new width (must be non-negative)height - The new height (must be non-negative)public static AreaBD setSizeFromMinYMinX(AreaBD area, BigDecimal width, BigDecimal height)
Set the width and height of area to width and height, respectively.
The area is resized by moving its minimum-y-minimum-x corner.
area - The areawidth - The new width (must be non-negative)height - The new height (must be non-negative)public static AreaBD setSizeFromMinYMaxX(AreaBD area, BigDecimal width, BigDecimal height)
Set the width and height of area to width and height, respectively.
The area is resized by moving its minimum-y-maximum-x corner.
area - The areawidth - The new width (must be non-negative)height - The new height (must be non-negative)public static AreaBD setSizeFromMaxYMaxX(AreaBD area, BigDecimal width, BigDecimal height)
Set the width and height of area to width and height, respectively.
The area is resized by moving its maximum-y-maximum-x corner.
area - The areawidth - The new width (must be non-negative)height - The new height (must be non-negative)public static AreaBD setSizeFromMaxYMinX(AreaBD area, BigDecimal width, BigDecimal height)
Set the width and height of area to width and height, respectively.
The area is resized by moving its maximum-y-minimum-x corner.
area - The areawidth - The new width (must be non-negative)height - The new height (must be non-negative)public static AreaBD scaleFromMinYMinX(AreaBD area, BigDecimal x_diff, BigDecimal y_diff)
Scale area by adding x_diff to the width, and y_diff to the height. The size of the resulting area is clamped so that
its width and height are always non-negative.
The area is resized by moving its minimum-y-minimum-x corner.
area - The areax_diff - The X differencey_diff - The Y differencepublic static AreaBD scaleFromMinYMaxX(AreaBD area, BigDecimal x_diff, BigDecimal y_diff)
Scale area by adding x_diff to the width, and y_diff to the height. The size of the resulting area is clamped so that
its width and height are always non-negative.
The area is resized by moving its minimum-y-maximum-x corner.
area - The areax_diff - The X differencey_diff - The Y differencepublic static AreaBD scaleFromMaxYMinX(AreaBD area, BigDecimal x_diff, BigDecimal y_diff)
Scale area by adding x_diff to the width, and y_diff to the height. The size of the resulting area is clamped so that
its width and height are always non-negative.
The area is resized by moving its maximum-y-minimum-x corner.
area - The areax_diff - The X differencey_diff - The Y differencepublic static AreaBD scaleFromMaxYMaxX(AreaBD area, BigDecimal x_diff, BigDecimal y_diff)
Scale area by adding x_diff to the width, and y_diff to the height. The size of the resulting area is clamped so that
its width and height are always non-negative.
The area is resized by moving its maximum-y-maximum-x corner.
area - The areax_diff - The X differencey_diff - The Y differencepublic static AreaBD scaleFromCenter(AreaBD area, BigDecimal x_diff, BigDecimal y_diff)
Scale area by adding x_diff to the width, and y_diff to the height. The size of the resulting area is clamped so that
its width and height are always non-negative.
The area is resized from its own center.
area - The areax_diff - The X differencey_diff - The Y differencepublic static boolean overlaps(AreaBD a, AreaBD b)
Determine whether or not two areas overlap.
Overlapping is reflexive: overlaps(a, a) == true.
Overlapping is symmetric: overlaps(a, b) == contains(b, a).
Overlapping is not necessarily transitive.
a - An areab - An areatrue iff a overlaps bpublic static boolean couldFitInside(AreaBD a, AreaBD b)
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.
a - An areab - An areatrue iff a could fit inside bpublic static AreaBD containing(AreaBD a, AreaBD b)
a and b.a - An areab - An areaa and bpublic static boolean containsPoint(AreaBD a, BigDecimal x, BigDecimal y)
Determine whether or not a area contains a given point.
a - An areax - The X coordinate of the pointy - The Y coordinate of the pointtrue iff a contains (x, y)public static AreaBD fitBetweenHorizontal(AreaBD fit, AreaBD a, AreaBD b)
fit between a and b, horizontally.fit - The area to be fitteda - An areab - An areapublic static AreaBD fitBetweenVertical(AreaBD fit, AreaBD a, AreaBD b)
fit between a and b, vertically.fit - The area to be fitteda - An areab - An areapublic static AreaXSplitBD<AreaBD> splitAlongParallelToX(AreaBD area, BigDecimal y)
area along a line parallel to the X axis placed at
y units from its own minimum-y edge.area - The area to be splity - The relative Y coordinate of the splitting edgepublic static AreaYSplitBD<AreaBD> splitAlongParallelToY(AreaBD area, BigDecimal x)
area along a line parallel to the Y axis placed at
x units from its own minimum-x edge.area - The area to be splitx - The relative X coordinate of the splitting edgepublic static String show(AreaBD area)
area - The areapublic static AreaSizeBD size(AreaBD area)
area - The areapublic static String showToBuilder(AreaBD area, StringBuilder sb)
area - The areasb - A string builderCopyright © 2017 <code@io7m.com> http://io7m.com