public final class AreasF 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 AreaF |
alignCenter(AreaF outer,
AreaF inner)
Align the area
inner such that the center of the area is equal to
the center of outer. |
static AreaF |
alignHorizontallyCenter(AreaF outer,
AreaF inner)
Align the area
inner horizontally in the center of outer. |
static AreaF |
alignHorizontallyMaxX(AreaF outer,
AreaF inner)
Equivalent to calling
alignHorizontallyMaxXOffset(AreaF,
AreaF, float) with a zero offset. |
static AreaF |
alignHorizontallyMaxXOffset(AreaF outer,
AreaF inner,
float offset)
Align the area
inner horizontally against the inside maximum-x edge
of outer. |
static AreaF |
alignHorizontallyMinX(AreaF outer,
AreaF inner)
Equivalent to calling
alignHorizontallyMinXOffset(AreaF, AreaF,
float) with a zero offset. |
static AreaF |
alignHorizontallyMinXOffset(AreaF outer,
AreaF inner,
float offset)
Align the area
inner horizontally against the inside minimum-x edge
of outer. |
static AreaF |
alignMaxYMaxX(AreaF outer,
AreaF inner)
Equivalent to calling
alignMaxYMaxXOffset(AreaF, AreaF,
float, float) with zero offsets. |
static AreaF |
alignMaxYMaxXOffset(AreaF outer,
AreaF inner,
float offset_x,
float 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 AreaF |
alignMaxYMinX(AreaF outer,
AreaF inner)
Equivalent to calling
alignMaxYMinXOffset(AreaF, AreaF,
float, float) with zero offsets. |
static AreaF |
alignMaxYMinXOffset(AreaF outer,
AreaF inner,
float offset_x,
float 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 AreaF |
alignMinYMaxX(AreaF outer,
AreaF inner)
Equivalent to calling
alignMinYMaxXOffset(AreaF, AreaF,
float, float) with zero offsets. |
static AreaF |
alignMinYMaxXOffset(AreaF outer,
AreaF inner,
float offset_x,
float 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 AreaF |
alignMinYMinX(AreaF outer,
AreaF inner)
Equivalent to calling
alignMinYMinXOffset(AreaF, AreaF,
float, float) with zero offsets. |
static AreaF |
alignMinYMinXOffset(AreaF outer,
AreaF inner,
float offset_x,
float 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 AreaF |
alignVerticallyCenter(AreaF outer,
AreaF inner)
Align the area
inner vertically in the center of outer. |
static AreaF |
alignVerticallyMaxY(AreaF outer,
AreaF inner)
Equivalent to calling
alignVerticallyMaxYOffset(AreaF, AreaF,
float) with a zero offset. |
static AreaF |
alignVerticallyMaxYOffset(AreaF outer,
AreaF inner,
float offset)
Align the area
inner vertically against the inside maximum-y edge
of outer. |
static AreaF |
alignVerticallyMinY(AreaF outer,
AreaF inner)
Equivalent to calling
alignVerticallyMinYOffset(AreaF, AreaF,
float) with a zero offset. |
static AreaF |
alignVerticallyMinYOffset(AreaF outer,
AreaF inner,
float offset)
Align the area
inner vertically against the inside minimum-y edge
of outer. |
static AreaF |
containing(AreaF a,
AreaF b)
Construct a area that will contain both
a and b. |
static boolean |
contains(AreaF a,
AreaF b)
Determine whether or not one area contains another.
|
static boolean |
containsPoint(AreaF a,
float x,
float y)
Determine whether or not a area contains a given point.
|
static boolean |
couldFitInside(AreaF a,
AreaF b)
Determine whether or not one area could fit inside another.
|
static AreaF |
create(float x,
float y,
float width,
float height)
Create an area of width
width and height height, placing
the minimum corner at (x, y). |
static AreaF |
fitBetweenHorizontal(AreaF fit,
AreaF a,
AreaF b)
Attempt to fit
fit between a and b, horizontally. |
static AreaF |
fitBetweenVertical(AreaF fit,
AreaF a,
AreaF b)
Attempt to fit
fit between a and b, vertically. |
static AreaF |
hollowOut(AreaF outer,
float min_x_offset,
float max_x_offset,
float min_y_offset,
float max_y_offset)
Construct a new area that fits inside
outer based on the given
offsets from each edge. |
static AreaF |
hollowOutEvenly(AreaF outer,
float offset)
Equivalent to calling
hollowOut(AreaF, float, float,
float, float) with offset for all offset parameters. |
static AreaF |
moveAbsolute(AreaF area,
float x,
float y)
Move the given area to
(x, y). |
static AreaF |
moveRelative(AreaF area,
float x,
float y)
Move the given area by
(x, y). |
static AreaF |
moveToOrigin(AreaF area)
Move the given area to
(0, 0). |
static boolean |
overlaps(AreaF a,
AreaF b)
Determine whether or not two areas overlap.
|
static AreaF |
scaleFromCenter(AreaF area,
float x_diff,
float y_diff)
Scale
area by adding x_diff to the width, and y_diff to the height. |
static AreaF |
scaleFromMaxYMaxX(AreaF area,
float x_diff,
float y_diff)
Scale
area by adding x_diff to the width, and y_diff to the height. |
static AreaF |
scaleFromMaxYMinX(AreaF area,
float x_diff,
float y_diff)
Scale
area by adding x_diff to the width, and y_diff to the height. |
static AreaF |
scaleFromMinYMaxX(AreaF area,
float x_diff,
float y_diff)
Scale
area by adding x_diff to the width, and y_diff to the height. |
static AreaF |
scaleFromMinYMinX(AreaF area,
float x_diff,
float y_diff)
Scale
area by adding x_diff to the width, and y_diff to the height. |
static AreaF |
setSizeFromCenter(AreaF area,
float width,
float height)
Set the width and height of
area to width and height, respectively. |
static AreaF |
setSizeFromMaxYMaxX(AreaF area,
float width,
float height)
Set the width and height of
area to width and height, respectively. |
static AreaF |
setSizeFromMaxYMinX(AreaF area,
float width,
float height)
Set the width and height of
area to width and height, respectively. |
static AreaF |
setSizeFromMinYMaxX(AreaF area,
float width,
float height)
Set the width and height of
area to width and height, respectively. |
static AreaF |
setSizeFromMinYMinX(AreaF area,
float width,
float height)
Set the width and height of
area to width and height, respectively. |
static String |
show(AreaF area) |
static String |
showToBuilder(AreaF area,
StringBuilder sb) |
static AreaXSplitF<AreaF> |
splitAlongParallelToX(AreaF area,
float y)
Split
area along a line parallel to the X axis placed at
y units from its own minimum-y edge. |
static AreaYSplitF<AreaF> |
splitAlongParallelToY(AreaF area,
float x)
Split
area along a line parallel to the Y axis placed at
x units from its own minimum-x edge. |
public static AreaF create(float x, float y, float width, float 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(AreaF a, AreaF 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 AreaF moveRelative(AreaF area, float x, float y)
(x, y).area - The areax - The amount to move on the X axisy - The amount to move on the Y axispublic static AreaF moveAbsolute(AreaF area, float x, float 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 AreaF moveToOrigin(AreaF area)
(0, 0).area - The areapublic static AreaF alignHorizontallyCenter(AreaF outer, AreaF inner)
inner horizontally in the center of outer.outer - The outer areainner - The inner areapublic static AreaF alignHorizontallyMinX(AreaF outer, AreaF inner)
alignHorizontallyMinXOffset(AreaF, AreaF,
float) with a zero offset.outer - The outer areainner - The inner areapublic static AreaF alignHorizontallyMinXOffset(AreaF outer, AreaF inner, float 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 AreaF alignHorizontallyMaxX(AreaF outer, AreaF inner)
alignHorizontallyMaxXOffset(AreaF,
AreaF, float) with a zero offset.outer - The outer areainner - The inner areapublic static AreaF alignHorizontallyMaxXOffset(AreaF outer, AreaF inner, float 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 AreaF alignVerticallyMinY(AreaF outer, AreaF inner)
alignVerticallyMinYOffset(AreaF, AreaF,
float) with a zero offset.outer - The outer areainner - The inner areapublic static AreaF alignVerticallyMinYOffset(AreaF outer, AreaF inner, float 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 AreaF alignVerticallyMaxY(AreaF outer, AreaF inner)
alignVerticallyMaxYOffset(AreaF, AreaF,
float) with a zero offset.outer - The outer areainner - The inner areapublic static AreaF alignVerticallyMaxYOffset(AreaF outer, AreaF inner, float 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 AreaF alignVerticallyCenter(AreaF outer, AreaF inner)
inner vertically in the center of outer.outer - The outer areainner - The inner areapublic static AreaF alignMinYMinX(AreaF outer, AreaF inner)
alignMinYMinXOffset(AreaF, AreaF,
float, float) with zero offsets.outer - The outer areainner - The inner areapublic static AreaF alignMinYMinXOffset(AreaF outer, AreaF inner, float offset_x, float 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 AreaF alignMinYMaxX(AreaF outer, AreaF inner)
alignMinYMaxXOffset(AreaF, AreaF,
float, float) with zero offsets.outer - The outer areainner - The inner areapublic static AreaF alignMinYMaxXOffset(AreaF outer, AreaF inner, float offset_x, float 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 AreaF alignMaxYMinX(AreaF outer, AreaF inner)
alignMaxYMinXOffset(AreaF, AreaF,
float, float) with zero offsets.outer - The outer areainner - The inner areapublic static AreaF alignMaxYMinXOffset(AreaF outer, AreaF inner, float offset_x, float 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 AreaF alignMaxYMaxX(AreaF outer, AreaF inner)
alignMaxYMaxXOffset(AreaF, AreaF,
float, float) with zero offsets.outer - The outer areainner - The inner areapublic static AreaF alignMaxYMaxXOffset(AreaF outer, AreaF inner, float offset_x, float 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 AreaF alignCenter(AreaF outer, AreaF inner)
inner such that the center of the area is equal to
the center of outer.outer - The outer areainner - The inner areapublic static AreaF hollowOut(AreaF outer, float min_x_offset, float max_x_offset, float min_y_offset, float 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 AreaF hollowOutEvenly(AreaF outer, float offset)
hollowOut(AreaF, float, float,
float, float) with offset for all offset parameters.outer - The containing areaoffset - The offset from each edge (must be non-negative)public static AreaF setSizeFromCenter(AreaF area, float width, float 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 AreaF setSizeFromMinYMinX(AreaF area, float width, float 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 AreaF setSizeFromMinYMaxX(AreaF area, float width, float 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 AreaF setSizeFromMaxYMaxX(AreaF area, float width, float 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 AreaF setSizeFromMaxYMinX(AreaF area, float width, float 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 AreaF scaleFromMinYMinX(AreaF area, float x_diff, float 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 AreaF scaleFromMinYMaxX(AreaF area, float x_diff, float 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 AreaF scaleFromMaxYMinX(AreaF area, float x_diff, float 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 AreaF scaleFromMaxYMaxX(AreaF area, float x_diff, float 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 AreaF scaleFromCenter(AreaF area, float x_diff, float 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(AreaF a, AreaF 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(AreaF a, AreaF 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 AreaF containing(AreaF a, AreaF b)
a and b.a - An areab - An areaa and bpublic static boolean containsPoint(AreaF a, float x, float 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 AreaF fitBetweenHorizontal(AreaF fit, AreaF a, AreaF b)
fit between a and b, horizontally.fit - The area to be fitteda - An areab - An areapublic static AreaF fitBetweenVertical(AreaF fit, AreaF a, AreaF b)
fit between a and b, vertically.fit - The area to be fitteda - An areab - An areapublic static AreaXSplitF<AreaF> splitAlongParallelToX(AreaF area, float 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 AreaYSplitF<AreaF> splitAlongParallelToY(AreaF area, float 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(AreaF area)
area - The areapublic static String showToBuilder(AreaF area, StringBuilder sb)
area - The areasb - A string builderCopyright © 2017 <code@io7m.com> http://io7m.com