public abstract class EPoint extends AbstractFixpPoint implements java.io.Serializable
EPoint
immutable class defines a point representing a location
in (x, y) coordinate space. This class extends abstract class Point2D.
This class is used in Electric database. Coordiates are snapped to grid
according to
DBMath.round
method.Modifier and Type | Field and Description |
---|---|
static EPoint |
ORIGIN
EPoint with both zero coordinates.
|
Constructor and Description |
---|
EPoint() |
Modifier and Type | Method and Description |
---|---|
protected AbstractFixpPoint |
create(long fixpX,
long fixpY) |
boolean |
equals(EPoint that)
Returns true if this EPoint is equal to the other EPoint.
|
double |
fixpDistance(EPoint pt)
Returns the distance from this
EPoint to a specified
EPoint in fixed-point units. |
static EPoint |
fromFixp(long fixpX,
long fixpY)
Returns
EPoint with specified fixed-point coordinates. |
static EPoint |
fromGrid(long gridX,
long gridY)
Returns
EPoint with specified grid coordinates. |
static EPoint |
fromLambda(double lambdaX,
double lambdaY)
Returns
EPoint with specified grid coordinates. |
ECoord |
getCoordX()
Returns the X coordinate of this
EPoint as ECoord object. |
ECoord |
getCoordY()
Returns the Y coordinate of this
EPoint as ECoord object. |
long |
getFixpX()
Returns the X coordinate of this
EPoint in fixed-point units in
long precision. |
long |
getFixpY()
Returns the Y coordinate of this
EPoint in fixed-point units in
long precision. |
abstract long |
getGridX()
Returns the X coordinate of this
EPoint in grid units in
long precision. |
abstract long |
getGridY()
Returns the Y coordinate of this
EPoint in grid units in
long precision. |
double |
getLambdaX()
Returns the X coordinate of this
EPoint in lambda units in
double precision. |
double |
getLambdaY()
Returns the Y coordinate of this
EPoint in lambda units in
double precision. |
double |
getX()
Returns the X coordinate of this
EPoint in lambda units in
double precision. |
double |
getY()
Returns the Y coordinate of this
EPoint in lambda unuts in
double precision. |
double |
gridDistance(EPoint pt)
Returns the distance from this
EPoint to a specified
EPoint in grid units. |
java.awt.geom.Point2D.Double |
gridMutable()
Creates mutable
Point2D.Double from the
EPoint in grid units. |
double |
lambdaDistance(EPoint pt)
Returns the distance from this
EPoint to a specified
EPoint in lambda units. |
java.awt.geom.Point2D.Double |
lambdaMutable()
Creates mutable
Point2D.Double from the
EPoint in lambda units. |
void |
setFixpLocation(long fixpX,
long fixpY) |
void |
setLocation(double x,
double y)
This method overrides
Point2D.setLocation method. |
static EPoint |
snap(java.awt.geom.Point2D p)
Returns
EPoint from specified
Point2D snapped to the grid. |
distance, distanceSq, equals, setLocation, toString
public static final EPoint ORIGIN
public void setFixpLocation(long fixpX, long fixpY)
setFixpLocation
in class AbstractFixpPoint
protected AbstractFixpPoint create(long fixpX, long fixpY)
create
in class AbstractFixpPoint
public static EPoint fromLambda(double lambdaX, double lambdaY)
EPoint
with specified grid coordinates.lambdaX
- the x-coordinate in lambda units.lambdaY
- the y-coordinate in lambda units.public static EPoint fromFixp(long fixpX, long fixpY)
EPoint
with specified fixed-point coordinates.fixpX
- the x-coordinate in fixed-point units.fixpY
- the y-coordinate in fixed-point units.public static EPoint fromGrid(long gridX, long gridY)
EPoint
with specified grid coordinates.gridX
- the x-coordinate in grid units.gridY
- the y-coordinate in grid units.public static EPoint snap(java.awt.geom.Point2D p)
EPoint
from specified
Point2D
snapped to the grid.p
- specified Point2Dpublic double getX()
EPoint
in lambda units in
double
precision.getX
in class AbstractFixpPoint
EPoint
.public double getY()
EPoint
in lambda unuts in
double
precision.getY
in class AbstractFixpPoint
EPoint
.public ECoord getCoordX()
EPoint
as ECoord object.EPoint
.public ECoord getCoordY()
EPoint
as ECoord object.EPoint
.public double getLambdaX()
EPoint
in lambda units in
double
precision.EPoint
.public double getLambdaY()
EPoint
in lambda units in
double
precision.EPoint
.public long getFixpX()
EPoint
in fixed-point units in
long
precision.getFixpX
in class AbstractFixpPoint
EPoint
.public long getFixpY()
EPoint
in fixed-point units in
long
precision.getFixpY
in class AbstractFixpPoint
EPoint
.public abstract long getGridX()
EPoint
in grid units in
long
precision.EPoint
.public abstract long getGridY()
EPoint
in grid units in
long
precision.EPoint
.public void setLocation(double x, double y)
Point2D.setLocation
method. It throws
UnsupportedOperationException.setLocation
in class AbstractFixpPoint
x
- the x-coordinate to which to set this
EPoint
y
- the y-coordinate to which to set this
EPoint
java.lang.UnsupportedOperationException
public java.awt.geom.Point2D.Double lambdaMutable()
Point2D.Double
from the
EPoint
in lambda units.public java.awt.geom.Point2D.Double gridMutable()
Point2D.Double
from the
EPoint
in grid units.public double lambdaDistance(EPoint pt)
EPoint
to a specified
EPoint
in lambda units.pt
- the specified
EPoint
EPoint
and the specified
Point
in lambdaUnits.public double gridDistance(EPoint pt)
EPoint
to a specified
EPoint
in grid units.pt
- the specified
EPoint
EPoint
and the specified
Point
in gridUnits.public double fixpDistance(EPoint pt)
EPoint
to a specified
EPoint
in fixed-point units.pt
- the specified
EPoint
EPoint
and the specified
Point
in gridUnits.public boolean equals(EPoint that)
equals
, but it could be a little faster, because no virtual
method dispatching is required.Point2D.equals(java.lang.Object)