public class DBMath extends GenMath
Modifier and Type | Field and Description |
---|---|
static double |
GRID
Number of grid points per unit
|
MATID, MAX_SMALL_COORD, MIN_SMALL_COORD
Constructor and Description |
---|
DBMath() |
Modifier and Type | Method and Description |
---|---|
static boolean |
areEquals(double a,
double b)
Method to compare two double-precision database values.
|
static boolean |
areEquals(java.awt.geom.Point2D a,
java.awt.geom.Point2D b)
Method to compare two double-precision database coordinates within an
approximate epsilon.
|
static double |
getEpsilon()
To return private epsilon used for calculation.
|
static void |
gridAlign(java.awt.geom.Point2D pt,
EDimension alignment)
Method to snap a point to the nearest database-space grid unit.
|
static void |
gridAlign(java.awt.geom.Point2D pt,
EDimension alignment,
int direction)
Method to snap the X, Y or both coordinates of a point to the nearest
database-space grid unit
|
static double |
gridToLambda(double gridValue)
Method to convert a database value from grid units to lambda units.
|
static boolean |
hasRemainder(double a,
double divisor)
Method to calculate remainder for doubles and avoid rounding errors by
calculating the remainder for integers instead.
|
static boolean |
isGreaterThan(double a,
double b)
Method to determine if one value is greater than another, but counting
for rounding error
|
static boolean |
isGreaterThanOrEqualTo(double a,
double b)
Method to determine if one value is greater than or equal to another, but
counting for rounding error
|
static boolean |
isInBetween(double x,
double a,
double b)
Method to determine if a value is between two given values including the
boundary.
|
static boolean |
isInBetweenExclusive(double x,
double a,
double b)
Method to determine if a value is between two given values without the
boundary.
|
static boolean |
isLessThan(double a,
double b)
Method to determine if one value is less than another, but counting for
rounding error
|
static boolean |
isLessThanOrEqualTo(double a,
double b)
Method to determine if one value is less than or equal to another, but
counting for rounding error
|
static boolean |
isOnLine(java.awt.geom.Point2D end1,
java.awt.geom.Point2D end2,
java.awt.geom.Point2D pt)
Method to tell whether a point is on a given line segment.
|
static long |
lambdaToGrid(double lambdaValue)
Method to convert a database value from lambda units to grid units.
|
static long |
lambdaToSizeGrid(double lambdaValue)
Method to convert a database size value from lambda units to grid units.
|
static boolean |
pointInRect(AbstractFixpPoint pt,
AbstractFixpRectangle bounds) |
static boolean |
pointInRect(java.awt.geom.Point2D pt,
java.awt.geom.Rectangle2D bounds)
Method to tell whether a point is inside of a bounds, compensating for
possible database precision errors.
|
static boolean |
pointInsideRect(java.awt.geom.Point2D pt,
java.awt.geom.Rectangle2D bounds)
Method to determine if point is completely inside a bound and not along
its boundary.
|
static boolean |
rectsIntersect(java.awt.geom.Rectangle2D r1,
java.awt.geom.Rectangle2D r2)
Method to tell whether two Rectangle2D objects intersect.
|
static double |
round(double lambdaValue)
Method to round a database value to database precision.
|
static void |
transformRect(AbstractFixpRectangle bounds,
FixpTransform xform)
Method to transform an AbstractFixpRectangle by a given transformation.
|
static void |
transformRect(java.awt.geom.Rectangle2D bounds,
FixpTransform xform)
Method to transform a Rectangle2D by a given transformation.
|
addPoints, arcBBox, arcconnects, ceilInt, ceilLong, clipLine, clipLine, clipPoly, closestPointToLine, closestPointToLine, closestPointToSegment, closestPointToSegment, computeArcCenter, containedInRectangle, containedInRectangle, cos, cosSmall, distBetweenPoints, distToLine, doublesClose, doublesEqual, doublesEqual, doublesLessThan, figureAngle, figureAngle, figureAngleRadians, findCenters, findCenters, floorInt, floorLong, getArea, getAreaOfPoints, getQTreeBox, getQTreeBox, getQuadrants, getX, getY, intersect, intersectRadians, isMultiple, isNinetyDegreeRotation, isSmallInt, isSmallInt, meanEqualDistribution, objectsReallyEqual, packXY, polarToXY, primeSince, rint, roundInt, roundLong, roundToMultiple, roundToMultiple, roundToMultiple0, roundToMultipleCeiling, roundToMultipleFloor, sin, sinSmall, standardDeviation, toNearest, transformArrayIntoString, transformStringIntoArray, unsignedIntValue, varianceEqualDistribution, varianceEqualDistribution
public static final double GRID
public static double getEpsilon()
public static boolean pointInRect(java.awt.geom.Point2D pt, java.awt.geom.Rectangle2D bounds)
pt
- the point in questionbounds
- the bounds being testedpublic static boolean pointInRect(AbstractFixpPoint pt, AbstractFixpRectangle bounds)
public static boolean pointInsideRect(java.awt.geom.Point2D pt, java.awt.geom.Rectangle2D bounds)
pt
- the Point in question.bounds
- the bounds to test.public static boolean areEquals(double a, double b)
a
- the first number.b
- the second number.public static boolean isInBetween(double x, double a, double b)
x
- the value to test.a
- one end of the boundary.b
- the other end of the boundary.public static boolean isInBetweenExclusive(double x, double a, double b)
x
- the value to test.a
- one end of the boundary.b
- the other end of the boundary.public static boolean isGreaterThan(double a, double b)
a
- the first number.b
- the second number.public static boolean isLessThan(double a, double b)
a
- the first number.b
- the second number.public static boolean isGreaterThanOrEqualTo(double a, double b)
a
- the first number.b
- the second number.public static boolean isLessThanOrEqualTo(double a, double b)
a
- the first number.b
- the second number.public static double round(double lambdaValue)
lambdaValue
- the value to round in lambda units.public static long lambdaToGrid(double lambdaValue)
lambdaValue
- the value to round in lambda unit.public static long lambdaToSizeGrid(double lambdaValue)
lambdaValue
- the value to round in lambda unit.public static double gridToLambda(double gridValue)
gridValue
- the value in grid unit.public static void gridAlign(java.awt.geom.Point2D pt, EDimension alignment)
pt
- the point to be snapped.alignment
- the alignment values to use in X and Y.public static void gridAlign(java.awt.geom.Point2D pt, EDimension alignment, int direction)
pt
- the point to be snapped.alignment
- the alignment values to use in X and Y.direction
- -1 if X and Y coordinates, 0 if only X and 1 if only Ypublic static boolean areEquals(java.awt.geom.Point2D a, java.awt.geom.Point2D b)
a
- the first point.b
- the second point.public static boolean isOnLine(java.awt.geom.Point2D end1, java.awt.geom.Point2D end2, java.awt.geom.Point2D pt)
end1
- the first end of the line segment.end2
- the second end of the line segment.pt
- the point in question.public static boolean hasRemainder(double a, double divisor)
a
- the numeratordivisor
- the denominator.public static void transformRect(AbstractFixpRectangle bounds, FixpTransform xform)
bounds
- the AbstractFixpRectangle to transform. It is transformed
"in place" (its coordinates are overwritten).xform
- the transformation matrix.public static void transformRect(java.awt.geom.Rectangle2D bounds, FixpTransform xform)
bounds
- the Rectangle to transform. It is transformed "in place"
(its coordinates are overwritten).xform
- the transformation matrix.public static boolean rectsIntersect(java.awt.geom.Rectangle2D r1, java.awt.geom.Rectangle2D r2)
r1
- the first rectangle.r2
- the second rectangle.