public final class AreasD 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 AreaD |
alignCenter(AreaD outer,
AreaD inner)
Align the area
inner such that the center of the area is equal to
the center of outer. |
static AreaD |
alignHorizontallyCenter(AreaD outer,
AreaD inner)
Deprecated.
|
static AreaD |
alignHorizontallyMaxX(AreaD outer,
AreaD inner)
Deprecated.
|
static AreaD |
alignHorizontallyMaxXOffset(AreaD outer,
AreaD inner,
double offset)
Deprecated.
|
static AreaD |
alignHorizontallyMinX(AreaD outer,
AreaD inner)
Deprecated.
|
static AreaD |
alignHorizontallyMinXOffset(AreaD outer,
AreaD inner,
double offset)
Deprecated.
|
static AreaD |
alignMaxYMaxX(AreaD outer,
AreaD inner)
Equivalent to calling
alignMaxYMaxXOffset(AreaD, AreaD,
double, double) with zero offsets. |
static AreaD |
alignMaxYMaxXOffset(AreaD outer,
AreaD inner,
double offset_x,
double 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 AreaD |
alignMaxYMinX(AreaD outer,
AreaD inner)
Equivalent to calling
alignMaxYMinXOffset(AreaD, AreaD,
double, double) with zero offsets. |
static AreaD |
alignMaxYMinXOffset(AreaD outer,
AreaD inner,
double offset_x,
double 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 AreaD |
alignMinYMaxX(AreaD outer,
AreaD inner)
Equivalent to calling
alignMinYMaxXOffset(AreaD, AreaD,
double, double) with zero offsets. |
static AreaD |
alignMinYMaxXOffset(AreaD outer,
AreaD inner,
double offset_x,
double 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 AreaD |
alignMinYMinX(AreaD outer,
AreaD inner)
Equivalent to calling
alignMinYMinXOffset(AreaD, AreaD,
double, double) with zero offsets. |
static AreaD |
alignMinYMinXOffset(AreaD outer,
AreaD inner,
double offset_x,
double 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 AreaD |
alignOnXCenter(AreaD outer,
AreaD inner)
Align the area
inner along the X axis in the center of outer. |
static AreaD |
alignOnXMaxX(AreaD outer,
AreaD inner)
Equivalent to calling
alignOnXMaxXOffset(AreaD,
AreaD, double) with a zero offset. |
static AreaD |
alignOnXMaxXOffset(AreaD outer,
AreaD inner,
double offset)
Align the area
inner along the X axis against the inside maximum-x edge
of outer. |
static AreaD |
alignOnXMinX(AreaD outer,
AreaD inner)
Equivalent to calling
alignOnXMinXOffset(AreaD, AreaD,
double) with a zero offset. |
static AreaD |
alignOnXMinXOffset(AreaD outer,
AreaD inner,
double offset)
Align the area
inner along the X axis against the inside minimum-x edge
of outer. |
static AreaD |
alignOnYCenter(AreaD outer,
AreaD inner)
Align the area
inner along the Y axis in the center of outer. |
static AreaD |
alignOnYMaxY(AreaD outer,
AreaD inner)
Equivalent to calling
alignOnYMaxYOffset(AreaD, AreaD,
double) with a zero offset. |
static AreaD |
alignOnYMaxYOffset(AreaD outer,
AreaD inner,
double offset)
Align the area
inner along the Y axis against the inside maximum-y edge
of outer. |
static AreaD |
alignOnYMinY(AreaD outer,
AreaD inner)
Equivalent to calling
alignOnYMinYOffset(AreaD, AreaD,
double) with a zero offset. |
static AreaD |
alignOnYMinYOffset(AreaD outer,
AreaD inner,
double offset)
Align the area
inner along the Y axis against the inside minimum-y edge
of outer. |
static AreaD |
alignVerticallyCenter(AreaD outer,
AreaD inner)
Deprecated.
|
static AreaD |
alignVerticallyMaxY(AreaD outer,
AreaD inner)
Deprecated.
|
static AreaD |
alignVerticallyMaxYOffset(AreaD outer,
AreaD inner,
double offset)
Deprecated.
|
static AreaD |
alignVerticallyMinY(AreaD outer,
AreaD inner)
Deprecated.
|
static AreaD |
alignVerticallyMinYOffset(AreaD outer,
AreaD inner,
double offset)
Deprecated.
|
static AreaD |
containing(AreaD a,
AreaD b)
Construct a area that will contain both
a and b. |
static boolean |
contains(AreaD a,
AreaD b)
Determine whether or not one area contains another.
|
static boolean |
containsPoint(AreaD a,
double x,
double y)
Determine whether or not a area contains a given point.
|
static boolean |
couldFitInside(AreaD a,
AreaD b)
Determine whether or not one area could fit inside another.
|
static AreaD |
create(double x,
double y,
double size_x,
double size_y)
Create an area of size
size_x on the X axis and size size_y
on the Y axis, placing the minimum corner at (x, y). |
static AreaD |
fitBetweenHorizontal(AreaD fit,
AreaD a,
AreaD b)
Deprecated.
|
static AreaD |
fitBetweenOnX(AreaD fit,
AreaD a,
AreaD b)
Attempt to fit
fit between a and b, horizontally. |
static AreaD |
fitBetweenOnY(AreaD fit,
AreaD a,
AreaD b)
Attempt to fit
fit between a and b, vertically. |
static AreaD |
fitBetweenVertical(AreaD fit,
AreaD a,
AreaD b)
Deprecated.
|
static AreaD |
hollowOut(AreaD outer,
double min_x_offset,
double max_x_offset,
double min_y_offset,
double max_y_offset)
Construct a new area that fits inside
outer based on the given
offsets from each edge. |
static AreaD |
hollowOutEvenly(AreaD outer,
double offset)
Equivalent to calling
hollowOut(AreaD, double, double,
double, double) with offset for all offset parameters. |
static AreaD |
moveAbsolute(AreaD area,
double x,
double y)
Move the given area to
(x, y). |
static AreaD |
moveRelative(AreaD area,
double x,
double y)
Move the given area by
(x, y). |
static AreaD |
moveToOrigin(AreaD area)
Move the given area to
(0, 0). |
static boolean |
overlaps(AreaD a,
AreaD b)
Determine whether or not two areas overlap.
|
static AreaD |
scaleFromCenter(AreaD area,
double x_diff,
double y_diff)
Scale
area by adding x_diff to the sizeX, and y_diff to the sizeY. |
static AreaD |
scaleFromMaxYMaxX(AreaD area,
double x_diff,
double y_diff)
Scale
area by adding x_diff to the sizeX, and y_diff to the sizeY. |
static AreaD |
scaleFromMaxYMinX(AreaD area,
double x_diff,
double y_diff)
Scale
area by adding x_diff to the sizeX, and y_diff to the sizeY. |
static AreaD |
scaleFromMinYMaxX(AreaD area,
double x_diff,
double y_diff)
Scale
area by adding x_diff to the sizeX, and y_diff to the sizeY. |
static AreaD |
scaleFromMinYMinX(AreaD area,
double x_diff,
double y_diff)
Scale
area by adding x_diff to the sizeX, and y_diff to the sizeY. |
static AreaD |
setSizeFromCenter(AreaD area,
double sizeX,
double sizeY)
Set the sizeX and sizeY of
area to sizeX and sizeY, respectively. |
static AreaD |
setSizeFromMaxYMaxX(AreaD area,
double sizeX,
double sizeY)
Set the sizeX and sizeY of
area to sizeX and sizeY, respectively. |
static AreaD |
setSizeFromMaxYMinX(AreaD area,
double sizeX,
double sizeY)
Set the sizeX and sizeY of
area to sizeX and sizeY, respectively. |
static AreaD |
setSizeFromMinYMaxX(AreaD area,
double sizeX,
double sizeY)
Set the sizeX and sizeY of
area to sizeX and sizeY, respectively. |
static AreaD |
setSizeFromMinYMinX(AreaD area,
double sizeX,
double sizeY)
Set the sizeX and sizeY of
area to sizeX and sizeY, respectively. |
static String |
show(AreaD area) |
static String |
showToBuilder(AreaD area,
StringBuilder sb) |
static AreaSizeD |
size(AreaD area) |
static AreaXSplitD<AreaD> |
splitAlongParallelToX(AreaD area,
double y)
Split
area along a line parallel to the X axis placed at
y units from its own minimum-y edge. |
static AreaYSplitD<AreaD> |
splitAlongParallelToY(AreaD area,
double x)
Split
area along a line parallel to the Y axis placed at
x units from its own minimum-x edge. |
static AreaXYSplitD<AreaD> |
splitAlongXY(AreaD area,
double x,
double y)
Split
area along a two axis-aligned perpendicular lines that intercept at (x, y). |
public static AreaD create(double x, double y, double size_x, double size_y)
size_x on the X axis and size size_y
on the Y axis, placing the minimum corner at (x, y).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 axispublic static boolean contains(AreaD a, AreaD 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 AreaD moveRelative(AreaD area, double x, double y)
(x, y).area - The areax - The amount to move on the X axisy - The amount to move on the Y axispublic static AreaD moveAbsolute(AreaD area, double x, double 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 AreaD moveToOrigin(AreaD area)
(0, 0).area - The areapublic static AreaD alignOnXCenter(AreaD outer, AreaD inner)
inner along the X axis in the center of outer.outer - The outer areainner - The inner areapublic static AreaD alignOnXMinX(AreaD outer, AreaD inner)
alignOnXMinXOffset(AreaD, AreaD,
double) with a zero offset.outer - The outer areainner - The inner areapublic static AreaD alignOnXMinXOffset(AreaD outer, AreaD inner, double offset)
inner along the X axis 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 edgepublic static AreaD alignOnXMaxX(AreaD outer, AreaD inner)
alignOnXMaxXOffset(AreaD,
AreaD, double) with a zero offset.outer - The outer areainner - The inner areapublic static AreaD alignOnXMaxXOffset(AreaD outer, AreaD inner, double offset)
inner along the X axis 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 edgepublic static AreaD alignOnYMinY(AreaD outer, AreaD inner)
alignOnYMinYOffset(AreaD, AreaD,
double) with a zero offset.outer - The outer areainner - The inner areapublic static AreaD alignOnYMinYOffset(AreaD outer, AreaD inner, double offset)
inner along the Y axis 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 edgepublic static AreaD alignOnYMaxY(AreaD outer, AreaD inner)
alignOnYMaxYOffset(AreaD, AreaD,
double) with a zero offset.outer - The outer areainner - The inner areapublic static AreaD alignOnYMaxYOffset(AreaD outer, AreaD inner, double offset)
inner along the Y axis 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 edgepublic static AreaD alignOnYCenter(AreaD outer, AreaD inner)
inner along the Y axis in the center of outer.outer - The outer areainner - The inner area@Deprecated public static AreaD alignHorizontallyCenter(AreaD outer, AreaD inner)
alignOnXCenter(AreaD, AreaD)inner horizontally in the center of outer.outer - The outer areainner - The inner area@Deprecated public static AreaD alignHorizontallyMinX(AreaD outer, AreaD inner)
alignOnXMinX(AreaD, AreaD)alignHorizontallyMinXOffset(AreaD, AreaD,
double) with a zero offset.outer - The outer areainner - The inner area@Deprecated public static AreaD alignHorizontallyMinXOffset(AreaD outer, AreaD inner, double offset)
alignOnXMinXOffset(AreaD, AreaD, double)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@Deprecated public static AreaD alignHorizontallyMaxX(AreaD outer, AreaD inner)
alignOnXMaxX(AreaD, AreaD)alignHorizontallyMaxXOffset(AreaD,
AreaD, double) with a zero offset.outer - The outer areainner - The inner area@Deprecated public static AreaD alignHorizontallyMaxXOffset(AreaD outer, AreaD inner, double offset)
alignOnXMaxXOffset(AreaD, AreaD, double)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@Deprecated public static AreaD alignVerticallyMinY(AreaD outer, AreaD inner)
alignOnYMinY(AreaD, AreaD)alignVerticallyMinYOffset(AreaD, AreaD,
double) with a zero offset.outer - The outer areainner - The inner area@Deprecated public static AreaD alignVerticallyMinYOffset(AreaD outer, AreaD inner, double offset)
alignOnYMinYOffset(AreaD, AreaD, double)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@Deprecated public static AreaD alignVerticallyMaxY(AreaD outer, AreaD inner)
alignOnYMaxY(AreaD, AreaD)alignVerticallyMaxYOffset(AreaD, AreaD,
double) with a zero offset.outer - The outer areainner - The inner area@Deprecated public static AreaD alignVerticallyMaxYOffset(AreaD outer, AreaD inner, double offset)
alignOnYMaxYOffset(AreaD, AreaD, double)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@Deprecated public static AreaD alignVerticallyCenter(AreaD outer, AreaD inner)
alignOnYCenter(AreaD, AreaD)inner vertically in the center of outer.outer - The outer areainner - The inner areapublic static AreaD alignMinYMinX(AreaD outer, AreaD inner)
alignMinYMinXOffset(AreaD, AreaD,
double, double) with zero offsets.outer - The outer areainner - The inner areapublic static AreaD alignMinYMinXOffset(AreaD outer, AreaD inner, double offset_x, double 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 AreaD alignMinYMaxX(AreaD outer, AreaD inner)
alignMinYMaxXOffset(AreaD, AreaD,
double, double) with zero offsets.outer - The outer areainner - The inner areapublic static AreaD alignMinYMaxXOffset(AreaD outer, AreaD inner, double offset_x, double 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 AreaD alignMaxYMinX(AreaD outer, AreaD inner)
alignMaxYMinXOffset(AreaD, AreaD,
double, double) with zero offsets.outer - The outer areainner - The inner areapublic static AreaD alignMaxYMinXOffset(AreaD outer, AreaD inner, double offset_x, double 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 AreaD alignMaxYMaxX(AreaD outer, AreaD inner)
alignMaxYMaxXOffset(AreaD, AreaD,
double, double) with zero offsets.outer - The outer areainner - The inner areapublic static AreaD alignMaxYMaxXOffset(AreaD outer, AreaD inner, double offset_x, double 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 AreaD alignCenter(AreaD outer, AreaD inner)
inner such that the center of the area is equal to
the center of outer.outer - The outer areainner - The inner areapublic static AreaD hollowOut(AreaD outer, double min_x_offset, double max_x_offset, double min_y_offset, double 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 AreaD hollowOutEvenly(AreaD outer, double offset)
hollowOut(AreaD, double, double,
double, double) with offset for all offset parameters.outer - The containing areaoffset - The offset from each edge (must be non-negative)public static AreaD setSizeFromCenter(AreaD area, double sizeX, double sizeY)
Set the sizeX and sizeY of area to sizeX and sizeY, respectively.
The area is resized from its own center.
area - The areasizeX - The new sizeX (must be non-negative)sizeY - The new sizeY (must be non-negative)public static AreaD setSizeFromMinYMinX(AreaD area, double sizeX, double sizeY)
Set the sizeX and sizeY of area to sizeX and sizeY, respectively.
The area is resized by moving its minimum-y-minimum-x corner.
area - The areasizeX - The new sizeX (must be non-negative)sizeY - The new sizeY (must be non-negative)public static AreaD setSizeFromMinYMaxX(AreaD area, double sizeX, double sizeY)
Set the sizeX and sizeY of area to sizeX and sizeY, respectively.
The area is resized by moving its minimum-y-maximum-x corner.
area - The areasizeX - The new sizeX (must be non-negative)sizeY - The new sizeY (must be non-negative)public static AreaD setSizeFromMaxYMaxX(AreaD area, double sizeX, double sizeY)
Set the sizeX and sizeY of area to sizeX and sizeY, respectively.
The area is resized by moving its maximum-y-maximum-x corner.
area - The areasizeX - The new sizeX (must be non-negative)sizeY - The new sizeY (must be non-negative)public static AreaD setSizeFromMaxYMinX(AreaD area, double sizeX, double sizeY)
Set the sizeX and sizeY of area to sizeX and sizeY, respectively.
The area is resized by moving its maximum-y-minimum-x corner.
area - The areasizeX - The new sizeX (must be non-negative)sizeY - The new sizeY (must be non-negative)public static AreaD scaleFromMinYMinX(AreaD area, double x_diff, double y_diff)
Scale area by adding x_diff to the sizeX, and y_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.
area - The areax_diff - The X differencey_diff - The Y differencepublic static AreaD scaleFromMinYMaxX(AreaD area, double x_diff, double y_diff)
Scale area by adding x_diff to the sizeX, and y_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.
area - The areax_diff - The X differencey_diff - The Y differencepublic static AreaD scaleFromMaxYMinX(AreaD area, double x_diff, double y_diff)
Scale area by adding x_diff to the sizeX, and y_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.
area - The areax_diff - The X differencey_diff - The Y differencepublic static AreaD scaleFromMaxYMaxX(AreaD area, double x_diff, double y_diff)
Scale area by adding x_diff to the sizeX, and y_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.
area - The areax_diff - The X differencey_diff - The Y differencepublic static AreaD scaleFromCenter(AreaD area, double x_diff, double y_diff)
Scale area by adding x_diff to the sizeX, and y_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.
area - The areax_diff - The X differencey_diff - The Y differencepublic static boolean overlaps(AreaD a, AreaD b)
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.
a - An areab - An areatrue iff a overlaps bpublic static boolean couldFitInside(AreaD a, AreaD 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 AreaD containing(AreaD a, AreaD b)
a and b.a - An areab - An areaa and bpublic static boolean containsPoint(AreaD a, double x, double 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)@Deprecated public static AreaD fitBetweenHorizontal(AreaD fit, AreaD a, AreaD b)
fitBetweenOnX(AreaD, AreaD, AreaD)fit between a and b, horizontally.fit - The area to be fitteda - An areab - An area@Deprecated public static AreaD fitBetweenVertical(AreaD fit, AreaD a, AreaD b)
fitBetweenOnY(AreaD, AreaD, AreaD)fit between a and b, vertically.fit - The area to be fitteda - An areab - An areapublic static AreaD fitBetweenOnX(AreaD fit, AreaD a, AreaD b)
fit between a and b, horizontally.fit - The area to be fitteda - An areab - An areapublic static AreaD fitBetweenOnY(AreaD fit, AreaD a, AreaD b)
fit between a and b, vertically.fit - The area to be fitteda - An areab - An areapublic static AreaXSplitD<AreaD> splitAlongParallelToX(AreaD area, double 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 AreaYSplitD<AreaD> splitAlongParallelToY(AreaD area, double 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 AreaXYSplitD<AreaD> splitAlongXY(AreaD area, double x, double y)
area along a two axis-aligned perpendicular lines that intercept at (x, y).area - The area to be splitx - The relative X coordinate of the splitting edgey - The relative Y coordinate of the splitting edgepublic static String show(AreaD area)
area - The areapublic static AreaSizeD size(AreaD area)
area - The areapublic static String showToBuilder(AreaD area, StringBuilder sb)
area - The areasb - A string builderCopyright © 2017 <code@io7m.com> http://io7m.com