public class Real2Range extends Object implements EuclidConstants
Default is two default/invalid RealRange components. Adding points will create valid ranges.
| Modifier and Type | Class and Description |
|---|---|
static class |
Real2Range.BoxDirection |
C_AMP, C_APOS, C_ATSIGN, C_BACKSLASH, C_BACKSPACE, C_CARET, C_COLON, C_COMMA, C_DEL, C_DOLLAR, C_EQUALS, C_FORMFEED, C_HASH, C_LANGLE, C_LBRAK, C_LCURLY, C_LSQUARE, C_MINUS, C_NBSP, C_NEWLINE, C_NL, C_PERCENT, C_PERIOD, C_PIPE, C_PLUS, C_POUND, C_QUERY, C_QUOT, C_RANGLE, C_RBRAK, C_RCURLY, C_RETURN, C_RSQUARE, C_SEMICOLON, C_SHRIEK, C_SLASH, C_SPACE, C_STAR, C_TAB, C_TILDE, C_UNDER, EPS, F_S, NONWHITEPUNC, NONWHITEPUNC0, NONWHITEPUNC0REGEX, ONE_THIRD, PUNC, S_AMP, S_APOS, S_ATSIGN, S_BACKSLASH, S_CARET, S_COLON, S_COMMA, S_DOLLAR, S_EMPTY, S_EQUALS, S_FORMFEED, S_HASH, S_LANGLE, S_LBRAK, S_LCURLY, S_LSQUARE, S_MINUS, S_NEWLINE, S_NL, S_PERCENT, S_PERIOD, S_PIPE, S_PLUS, S_POUND, S_QUERY, S_QUOT, S_RANGLE, S_RBRAK, S_RCURLY, S_RETURN, S_RSQUARE, S_SEMICOLON, S_SHRIEK, S_SLASH, S_SPACE, S_STAR, S_TAB, S_TILDE, S_UNDER, S_WHITEREGEX, TWO_THIRDS, U_S, WHITESPACE| Constructor and Description |
|---|
Real2Range()
constructor.
|
Real2Range(Real2Range r)
copy constructor
|
Real2Range(Real2 r2a,
Real2 r2b)
create from min corner of box and max corner
|
Real2Range(RealRange xr,
RealRange yr)
initialise with min and max values;
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Axis.Axis2 ax,
RealRange range)
merge range for given axis.
|
void |
add(Real2 p)
add a Real2 to a range
|
Double |
calculateArea() |
static Real2Range |
createFrom(String s)
reads in format of toString()
((a,b)(c,d))
|
Real2 |
distanceOutside(Real2 p)
gets minimum X and Y translations required to move point into range
uses RealRange.distanceOutside() - see this
|
Real2Range |
format(Integer decimalPlaces) |
static void |
format(List<Real2Range> boxList,
int nplaces) |
Real2 |
getCentroid()
get yrange
|
Real2[] |
getCorners()
gets lower left and upper right.
|
Dimension |
getDimension() |
Double |
getHorizontalVerticalRatio()
aspect ratio
|
Real2 |
getMidPoint(Real2Range.BoxDirection direction)
returns midPoint of box edge.
|
Real2Range |
getReal2RangeExtendedInX(double leftSide,
double rightSide)
extends XRange.
|
Real2Range |
getReal2RangeExtendedInY(double topExtend,
double bottomExtend)
extends XRange.
|
RealRange |
getRealRange(RealRange.Direction direction) |
Real2Range |
getTranformedRange(Transform2 t2)
transform range (as copy)
|
Double |
getXMax() |
Double |
getXMin() |
RealRange |
getXRange()
get xrange
|
Double |
getYMax() |
Double |
getYMin() |
RealRange |
getYRange()
get yrange
|
boolean |
includes(Real2 p)
is an Real2 within a Real2Range
|
boolean |
includes(Real2Range r)
is one Real2Range completely within another
|
Real2Range |
intersectionWith(Real2Range r2)
intersect two ranges and take the range common to both; return invalid
range if no overlap or either is null/invalid
|
boolean |
isContainedInAnyRange(List<Real2Range> r2rList)
iterates through all boxes and return true r2r is contained in any range
|
boolean |
isEqualTo(Real2Range r2)
Deprecated.
|
boolean |
isEqualTo(Real2Range r2,
double eps)
is equals to.
|
boolean |
isHorizontal() |
boolean |
isLessThan(Real2Range bbox)
compares boxes independent of origin.
|
static boolean |
isNull(Real2Range r2r) |
boolean |
isValid()
a Real2Range is valid if both its constituent ranges are
|
boolean |
isVertical() |
Real2Range |
plus(Real2Range r2)
merge two ranges and take the maximum extents
not sure the logic is right
if this is INVALID then replace with r2
if this is VALID and r2 is INVALID return this
else return union of the two
|
Real2Range |
plusEquals(Real2Range r2) |
void |
setXRange(RealRange xrange) |
void |
setYRange(RealRange yrange) |
String |
toString()
to string.
|
public Real2Range()
public Real2Range(RealRange xr, RealRange yr)
xr - yr - public Real2Range(Real2 r2a, Real2 r2b)
r2a - r2b - public Real2Range(Real2Range r)
r - public static Real2Range createFrom(String s)
s - public boolean isValid()
@Deprecated public boolean isEqualTo(Real2Range r2)
r2 - public boolean isEqualTo(Real2Range r2, double eps)
r2 - public Real2Range plus(Real2Range r2)
r2 - public Real2Range plusEquals(Real2Range r2)
public Real2Range intersectionWith(Real2Range r2)
r2 - public RealRange getXRange()
public RealRange getYRange()
public void setXRange(RealRange xrange)
public void setYRange(RealRange yrange)
public Real2 getCentroid()
public Real2[] getCorners()
public boolean includes(Real2 p)
p - public boolean includes(Real2Range r)
r - public void add(Real2 p)
p - public void add(Axis.Axis2 ax, RealRange range)
ax - axisrange - public Real2 distanceOutside(Real2 p)
p - public Real2Range getTranformedRange(Transform2 t2)
t2 - public Real2Range format(Integer decimalPlaces)
public static boolean isNull(Real2Range r2r)
public boolean isHorizontal()
public boolean isVertical()
public Double getHorizontalVerticalRatio()
public RealRange getRealRange(RealRange.Direction direction)
public boolean isContainedInAnyRange(List<Real2Range> r2rList)
r2rList - public Dimension getDimension()
public Double getXMin()
public Double getXMax()
public Double getYMin()
public Double getYMax()
public Real2Range getReal2RangeExtendedInX(double leftSide, double rightSide)
leftSide - rightSide - public Real2Range getReal2RangeExtendedInY(double topExtend, double bottomExtend)
topExtend - bottomExtend - public static void format(List<Real2Range> boxList, int nplaces)
public Double calculateArea()
public Real2 getMidPoint(Real2Range.BoxDirection direction)
direction - public boolean isLessThan(Real2Range bbox)
bbox - Copyright © 1994–2024 Peter Murray-Rust. All rights reserved.