public class Orientation
extends java.lang.Object
implements java.io.Serializable
Orientation
represents 2D affine transform which is composition
of rotation and possible flip. The C code used an angle (in tenth-degrees)
and a "transpose" factor which would flip the object along the major diagonal
after rotation. The Java code uses the same angle (in tenth-degrees) but has
two mirror options: Mirror X and Mirror Y.Modifier and Type | Field and Description |
---|---|
static Orientation |
IDENT
Identical Orientation
|
static Orientation |
R |
static Orientation |
RR |
static Orientation |
RRR |
static Orientation |
X |
static Orientation |
XR |
static Orientation |
XRR |
static Orientation |
XRRR |
static Orientation |
XY |
static Orientation |
XYR |
static Orientation |
XYRR |
static Orientation |
XYRRR |
static Orientation |
Y |
static Orientation |
YR |
static Orientation |
YRR |
static Orientation |
YRRR |
Modifier and Type | Method and Description |
---|---|
Orientation |
canonic()
Return canonical Orientation to this Orientation.
|
Orientation |
concatenate(Orientation that)
Concatenates this Orientation with other Orientation.
|
static Orientation |
fromAngle(int angle)
Get Orientation by the angle without mirrors.
|
static Orientation |
fromC(int cAngle,
boolean cTranspose)
Get Orientation by the old C style parameters.
|
static Orientation |
fromJava(int jAngle,
boolean jMirrorX,
boolean jMirrorY)
Get Orientation by the new Java style parameters.
|
static Orientation |
fromQuadrants(int numquadrants)
Get Orientation by the angle without mirrors.
|
int |
getAngle()
Method to return the new Java style angle value.
|
int |
getCAngle()
Method to return the old C style angle value.
|
double |
getDeterminant()
Method to return an exact determinant of the transformation.
|
int |
getType()
Method to return type of the transform as defined in
AffineTransform.getType() |
Orientation |
inverse()
Return inverse Orientation to this Orientation.
|
boolean |
isCTranspose()
Method to return the old C style transpose factor.
|
boolean |
isIdent()
Returns true if orientation is identical.
|
boolean |
isManhattan()
Returns true if orientation is one of Manhattan orientations.
|
boolean |
isXMirrored()
Method to return the new Java style Mirror X factor.
|
boolean |
isYMirrored()
Method to return the new Java style Mirror Y factor.
|
FixpTransform |
pureRotate()
Method to return a transformation that rotates an object.
|
void |
rectangleBounds(AbstractFixpRectangle src,
long fixpCX,
long fixpCY,
AbstractFixpRectangle dst)
Calculate bounds of rectangle transformed by this Orientation.
|
void |
rectangleBounds(double xl,
double yl,
double xh,
double yh,
double cx,
double cy,
java.awt.geom.Rectangle2D dst)
Calculate bounds of rectangle transformed by this Orientation.
|
void |
rectangleBounds(int[] coords)
Calculate bounds of rectangle transformed by this Orientation.
|
void |
rectangleBounds(long[] coords)
Calculate bounds of rectangle transformed by this Orientation.
|
void |
rectangleBounds(java.awt.geom.Rectangle2D src,
java.awt.geom.Point2D c,
java.awt.geom.Rectangle2D dst)
Calculate bounds of rectangle transformed by this Orientation.
|
FixpTransform |
rotateAbout(AbstractFixpPoint c)
Method to return a transformation that rotates an object about a point.
|
FixpTransform |
rotateAbout(double cX,
double cY)
Method to return a transformation that rotates an object about a point.
|
FixpTransform |
rotateAbout(double aX,
double aY,
double bX,
double bY)
Method to return a transformation that translate an object then rotates
and the again translates.
|
java.lang.String |
toJelibString()
Returns string which represents this Orientation in JELIB format.
|
java.lang.String |
toString()
Returns text representation of this Orientation.
|
void |
transform(long fixpX,
long fixpY,
AbstractFixpPoint[] ptSrc,
int srcOff,
AbstractFixpPoint[] ptDst,
int dstOff,
int numPts) |
java.awt.geom.Point2D |
transform(long fixpX,
long fixpY,
java.awt.geom.Point2D ptSrc,
java.awt.geom.Point2D ptDst) |
int |
transformAngle(int angle)
Method to transform direction by the Orientation.
|
java.awt.geom.Point2D |
transformPoint(java.awt.geom.Point2D coord)
Calculate the transformation of a Point by this Orientation.
|
void |
transformPoints(int numPoints,
int[] coords)
Calculate points transformed by this Orientation.
|
void |
transformPoints(int numPoints,
int[] srcCoords,
int[] dstCoords)
Calculate points transformed by this Orientation.
|
void |
transformPoints(int numPoints,
long[] coords)
Calculate points transformed by this Orientation.
|
void |
transformPoints(int numPoints,
long[] srcCoords,
long[] dstCoords)
Calculate points transformed by this Orientation.
|
double |
transformX(double x,
double y)
Calculate X-coordinate transformation of a Point by this Orientation.
|
long |
transformX(long x,
long y)
Calculate X-coordinate transformation of a Point by this Orientation.
|
double |
transformY(double x,
double y)
Calculate Y-coordinate transformation of a Point by this Orientation.
|
long |
transformY(long x,
long y)
Calculate Y-coordinate transformation of a Point by this Orientation.
|
public static final Orientation IDENT
public static final Orientation R
public static final Orientation RR
public static final Orientation RRR
public static final Orientation X
public static final Orientation XR
public static final Orientation XRR
public static final Orientation XRRR
public static final Orientation Y
public static final Orientation YR
public static final Orientation YRR
public static final Orientation YRRR
public static final Orientation XY
public static final Orientation XYR
public static final Orientation XYRR
public static final Orientation XYRRR
public static Orientation fromJava(int jAngle, boolean jMirrorX, boolean jMirrorY)
jAngle
- the angle of rotation (in tenth-degrees)jMirrorX
- if true, object is flipped over the vertical (mirror in
X).jMirrorY
- if true, object is flipped over the horizontal (mirror in
Y).public static Orientation fromC(int cAngle, boolean cTranspose)
cAngle
- the angle of rotation (in tenth-degrees)cTranspose
- if true, object is flipped over the major diagonal
after rotation.public static Orientation fromAngle(int angle)
angle
- the angle of rotation (in tenth-degrees)public static Orientation fromQuadrants(int numquadrants)
numquadrants
- the angle of rotation (in ninety-degrees)public Orientation inverse()
public Orientation canonic()
public Orientation concatenate(Orientation that)
that
- other Orientation.public int getCAngle()
public boolean isCTranspose()
public int getAngle()
public boolean isXMirrored()
public boolean isYMirrored()
public boolean isManhattan()
public boolean isIdent()
public FixpTransform pureRotate()
public double getDeterminant()
public int getType()
AffineTransform.getType()
public FixpTransform rotateAbout(AbstractFixpPoint c)
c
- the center point about which to rotate.public FixpTransform rotateAbout(double cX, double cY)
cX
- the center X coordinate about which to rotate.cY
- the center Y coordinate about which to rotate.public FixpTransform rotateAbout(double aX, double aY, double bX, double bY)
aX
- the center X coordinate to translate after rotation.aY
- the center Y coordinate to translate after rotation.bX
- the center X coordinate to translate before rotation.bY
- the center Y coordinate to translate before rotation.public int transformAngle(int angle)
angle
- the angle of initial direction in tenth-degrees.public java.awt.geom.Point2D transform(long fixpX, long fixpY, java.awt.geom.Point2D ptSrc, java.awt.geom.Point2D ptDst)
public void transform(long fixpX, long fixpY, AbstractFixpPoint[] ptSrc, int srcOff, AbstractFixpPoint[] ptDst, int dstOff, int numPts)
public void transformPoints(int numPoints, long[] srcCoords, long[] dstCoords)
numPoints
- srcCoords
- coordinates x, y of points.public void transformPoints(int numPoints, int[] srcCoords, int[] dstCoords)
numPoints
- srcCoords
- coordinates x, y of points.public void transformPoints(int numPoints, long[] coords)
numPoints
- coords
- coordinates x, y of points.public void transformPoints(int numPoints, int[] coords)
numPoints
- coords
- coordinates x, y of points.public long transformX(long x, long y)
x
- X-coordinate of the Pointy
- Y-coordinate of the Pointpublic long transformY(long x, long y)
x
- X-coordinate of the Pointy
- Y-coordinate of the Pointpublic double transformX(double x, double y)
x
- X-coordinate of the Pointy
- Y-coordinate of the Pointpublic double transformY(double x, double y)
x
- X-coordinate of the Pointy
- Y-coordinate of the Pointpublic java.awt.geom.Point2D transformPoint(java.awt.geom.Point2D coord)
coord
- the point to transform.public void rectangleBounds(java.awt.geom.Rectangle2D src, java.awt.geom.Point2D c, java.awt.geom.Rectangle2D dst)
src
- rectangle.c
- shiftdst
- destination rectangle.public void rectangleBounds(AbstractFixpRectangle src, long fixpCX, long fixpCY, AbstractFixpRectangle dst)
src
- rectangle.fixpCX
- shift X in fixed-point unitsfixpCY
- shift Y in fixed-point unitsdst
- destination rectangle.public void rectangleBounds(double xl, double yl, double xh, double yh, double cx, double cy, java.awt.geom.Rectangle2D dst)
xl
- lower x coordinate.yl
- lower y coordinate.xh
- higher x coordinate.yh
- higher y coordinate.cx
- additional x shiftcy
- additional y shift.dst
- destination rectangle.public void rectangleBounds(long[] coords)
coords
- coordinates [0]=low X, [1]=low Y, [2]=high X, [3]=high Y.public void rectangleBounds(int[] coords)
coords
- coordinates [0]=low X, [1]=low Y, [2]=high X, [3]=high Y.public java.lang.String toJelibString()
public java.lang.String toString()
toString
in class java.lang.Object