public class FixpCoord extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<FixpCoord>
GRIDS_IN_LAMBDA
.
Internal computations (like non-manhattan rotation) can produce
coordinates that are not grid-aligned.
They are represented as fixed-point long numbers.
Their fractional bits can represent fraction of the grid step.Modifier and Type | Field and Description |
---|---|
static FixpCoord |
FIXP
Fixed-point unit.
|
static double |
FIXP_SCALE
Multiplier from grid values to fixed-point values.
|
static int |
FRACTION_BITS
Number of fractional bits in fixed-point numbers.
|
static ECoord |
GRID
Database grid unit.
|
static long |
GRIDS_IN_LAMBDA
Number of database grid steps in lambda unit.
|
static ECoord |
LAMBDA
Lambda unit.
|
static ECoord |
SIZE_GRID
Database sizes is aligned at size grid.
|
static ECoord |
ZERO
Zero coordinate.
|
Modifier and Type | Method and Description |
---|---|
FixpCoord |
add(FixpCoord y)
Returns sum of two coordinats.
|
ECoord |
ceil(ECoord resolution) |
static long |
ceil(long fixp,
ECoord resolution) |
int |
compareTo(FixpCoord that) |
boolean |
equals(java.lang.Object o) |
static double |
fixpToGridDouble(long fixp) |
static java.awt.geom.Point2D.Double |
fixpToGridPoint(long fixpX,
long fixpY) |
static double |
fixpToLambda(long fixp) |
static java.awt.geom.Point2D.Double |
fixpToLambdaPoint(long fixpX,
long fixpY) |
ECoord |
floor(ECoord resolution) |
static long |
floor(long fixp,
ECoord resolution) |
static FixpCoord |
fromFixp(long fixp)
Creates FixpCoord object from fixed-point long.
|
static FixpCoord |
fromLambda(double lambda) |
static ECoord |
fromLambdaRoundGrid(double lambda) |
static ECoord |
fromLambdaRoundSizeGrid(double lambda) |
long |
getFixp()
Returns this number measured in fixed-point units.
|
double |
getLambda()
Returns this number measured in lambda units.
|
int |
hashCode() |
boolean |
isExact(ECoord resolution)
Returns true if this coordinate is aligned at a grid specified by parameter
|
static boolean |
isMultiple(long fixp,
ECoord resolution)
Returns true if the first coordinate is the multiple of the second.
|
static long |
lambdaRound(double lambda,
ECoord resolution) |
static long |
lambdaToFixp(double lambda) |
static long |
lambdaToGridFixp(double lambda) |
static long |
lambdaToSizeGridFixp(double lambda) |
FixpCoord |
max(FixpCoord y)
Returns maximum of two coordinats.
|
FixpCoord |
min(FixpCoord y)
Returns minimum of two coordinats.
|
FixpCoord |
multiply(double scale)
Returns product of this coordinate by double multiplier.
|
FixpCoord |
multiply(long scale)
Returns product of this coordinate by long multiplier.
|
ECoord |
round(ECoord resolution) |
static long |
round(long fixp,
ECoord resolution) |
int |
signum() |
FixpCoord |
subtract(FixpCoord y)
Returns difference of two coordinats.
|
java.lang.String |
toString() |
public static final int FRACTION_BITS
public static final double FIXP_SCALE
public static final long GRIDS_IN_LAMBDA
public static final ECoord ZERO
public static final FixpCoord FIXP
public static final ECoord GRID
public static final ECoord SIZE_GRID
public static final ECoord LAMBDA
public static FixpCoord fromFixp(long fixp)
fixp
- fixed-point longpublic static FixpCoord fromLambda(double lambda)
public static ECoord fromLambdaRoundGrid(double lambda)
public static ECoord fromLambdaRoundSizeGrid(double lambda)
public static long lambdaToSizeGridFixp(double lambda)
public static long lambdaToGridFixp(double lambda)
public static long lambdaToFixp(double lambda)
public boolean isExact(ECoord resolution)
resolution
- grid stepresolution
public static boolean isMultiple(long fixp, ECoord resolution)
fixp
- the first coordinate as fixed-number longresolution
- the second coordinarefixp
is the multiple of resolution
public static long lambdaRound(double lambda, ECoord resolution)
public static long round(long fixp, ECoord resolution)
public static long floor(long fixp, ECoord resolution)
public static long ceil(long fixp, ECoord resolution)
public int signum()
public double getLambda()
public static double fixpToLambda(long fixp)
public static double fixpToGridDouble(long fixp)
public static java.awt.geom.Point2D.Double fixpToGridPoint(long fixpX, long fixpY)
public static java.awt.geom.Point2D.Double fixpToLambdaPoint(long fixpX, long fixpY)
public long getFixp()
public FixpCoord add(FixpCoord y)
y
- second coordinate.public FixpCoord subtract(FixpCoord y)
y
- second coordinate.public FixpCoord multiply(double scale)
scale
- multiplierpublic FixpCoord multiply(long scale)
scale
- multiplierpublic FixpCoord min(FixpCoord y)
y
- second coordinate.public FixpCoord max(FixpCoord y)
y
- second coordinate.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
Object.equals(java.lang.Object)
public int hashCode()
hashCode
in class java.lang.Object
Object.hashCode()
public java.lang.String toString()
toString
in class java.lang.Object
Object.toString()