P
- Point implementation typeB
- Bounds implementation typepublic abstract class AbstractBounds<P extends EuclideanVector<P>,B extends AbstractBounds<P,B>> extends Object
Modifier | Constructor and Description |
---|---|
protected |
AbstractBounds(P min,
P max)
Simple constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract boolean |
contains(P pt)
Return true if the given point is strictly within or on the boundary of the bounding box.
|
abstract boolean |
contains(P pt,
Precision.DoubleEquivalence precision)
Return true if the given point is within or on the boundary of the bounding box, using the given
precision context for floating point comparisons.
|
boolean |
eq(B other,
Precision.DoubleEquivalence precision)
Return true if the current instance and argument are considered equal as evaluated by the
given precision context.
|
P |
getCentroid()
Get the centroid, or geometric center, of the bounding box.
|
P |
getDiagonal()
Get the diagonal of the bounding box.
|
P |
getMax()
Get the maximum point.
|
P |
getMin()
Get the minimum point.
|
abstract boolean |
hasSize(Precision.DoubleEquivalence precision)
Return true if the bounding box has non-zero size along each coordinate axis, as
evaluated by the given precision context.
|
abstract B |
intersection(B other)
Return the intersection of this bounding box and the argument, or null if no intersection exists.
|
abstract boolean |
intersects(B other)
Return true if any point on the interior or boundary of this instance is also considered to be
on the interior or boundary of the argument.
|
abstract HyperplaneBoundedRegion<P> |
toRegion(Precision.DoubleEquivalence precision)
Return a hyperplane-bounded region containing the same points as this instance.
|
String |
toString() |
protected AbstractBounds(P min, P max)
min
are less than or equal to their corresponding values in max
.
No validation is performed.min
- minimum pointmax
- maximum pointpublic P getDiagonal()
min
to max
and contains the size of the box along each coordinate axis.public P getCentroid()
public abstract boolean hasSize(Precision.DoubleEquivalence precision)
precision
- precision context used for floating point comparisonspublic abstract boolean contains(P pt)
pt >= mint
and
pt <= maxt
for each coordinate value t
.
Floating point comparisons are strict; values are considered equal only if they match exactly.pt
- the point to checkcontains(EuclideanVector, Precision.DoubleEquivalence)
public abstract boolean contains(P pt, Precision.DoubleEquivalence precision)
contains(EuclideanVector)
but allows points that may be strictly outside of the box due to floating point errors to be considered
inside.pt
- the point to checkprecision
- precision context used to compare floating point valuescontains(EuclideanVector, Precision.DoubleEquivalence)
public abstract boolean intersects(B other)
aMint <= bMaxt
and aMaxt >= bMint
for all coordinate values t
, where a
is the current instance and b
is the argument.
Floating point comparisons are strict; values are considered equal only if they match exactly.other
- bounding box to intersect withpublic abstract B intersection(B other)
other
- bounding box to intersect withintersects(AbstractBounds)
public abstract HyperplaneBoundedRegion<P> toRegion(Precision.DoubleEquivalence precision)
precision
- precision context used for floating point comparisons in the returned
region instancepublic boolean eq(B other, Precision.DoubleEquivalence precision)
other
- bounds to compare withprecision
- precision context to compare floating point numbersEuclideanVector.eq(EuclideanVector, Precision.DoubleEquivalence)
Copyright © 2016–2021 The Apache Software Foundation. All rights reserved.