|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gishur.x2.core.XObject | +--gishur.x2.core.XPoint
A point in double precision.
Field Summary | |
static double |
IDENTICAL
Minimum distance between two point, under which the point are treated as equal. |
static int |
LIES_BEFORE
Test point lies before the other points |
static int |
LIES_BEHIND
Test point lies behind the other points |
static int |
LIES_BETWEEN
Test point lies between the points |
static int |
ORIENTATION_COLLINEAR
Points are collinear. |
static int |
ORIENTATION_LEFT
Points are counterclockwise. |
static int |
ORIENTATION_RIGHT
Points are clockwise. |
static int |
ORIENTATION_UNDEFINED
Undefined orientation. |
static XPoint |
ORIGIN
The origin (0,0) point. |
Fields inherited from class gishur.x2.core.XObject |
RESERVED_STATE_MAX_MASK, STATE_DIRTY, STATE_LOCKED, STATE_MUTABLE |
Constructor Summary | |
XPoint(double x,
double y)
Creates a new point (x,y). |
Method Summary | |
XPoint |
add(XPoint v)
Adds this vector to v . |
double |
angle()
Return the angle with the origin and the X-axe. |
static double |
angle(double x,
double y)
Return the angle between the segment (0,0)-(x,y) and the x-axe. |
static double |
angle(double x,
double y,
double x1,
double y1,
double x2,
double y2)
Returns the angle (x1,y1)-(x,y)-(x2,y2) (in Radiant). |
double |
angle(XPoint q)
Returns the angle between the line through this and
q with the abscissa (x-axis). |
double |
angle(XPoint q,
XPoint r)
Returns the angle q-this-r (in Radiant). |
int |
compareTo(java.lang.Object o)
Compares this Object with the specified Object for order. |
int |
compareTo(XPoint p)
Compares this point with the specified point for order. |
static XPoint |
create(double x,
double y)
|
static XPoint |
createMiddle(XPoint a,
XPoint b)
Creates a point in the middle between this point
and p . |
static XPoint |
createPolar(double angle,
double length)
|
static double |
distance(double x1,
double y1,
double x2,
double y2)
Computes the euclidean distance between two given points. |
double |
distance(XPoint p)
Computes the the euclidean distance between this point and the given point p . |
static double |
distance(XPoint a,
XPoint b)
Computes the euclidean distance between two given points. |
static double |
distanceSq(double x1,
double y1,
double x2,
double y2)
Computes the square of the euclidean distance between two given points. |
double |
distanceSq(XPoint p)
Computes the square of the euclidean distance between this point and the given point p . |
static double |
distanceSq(XPoint a,
XPoint b)
Computes the square of the euclidean distance between two given points. |
boolean |
equals(double x,
double y)
Determines whether two points are equal. |
boolean |
equals(java.lang.Object o)
Determines whether two objects ( this and o )
are equal. |
boolean |
equals(XPoint p)
Determines whether two points are equal. |
java.lang.Object |
getOldXObject()
Returns corresponding old gishur.x-object. |
protected XObject[] |
getXObjectMembers()
This method should return all XObject members that contain geometric information. |
static boolean |
inSector(double x,
double y,
double x0,
double y0,
double x1,
double y1,
double x2,
double y2)
Checks if the point (x,y) lies in the (convex) sector
(x1,y1)-(x0,y0)-(x2,y2) (with apex (x0,y0) ). |
static boolean |
inSector(XPoint x,
XPoint p,
XPoint a,
XPoint b)
Checks if the point x lies in the (convex) sector
a-p-b (with apex p ). |
static boolean |
inTria(double x,
double y,
double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
Checks if the point (x,y) lies in the triangle
(x1,y1)-(x2,y2)-(x3,y3) . |
static boolean |
inTria(XPoint x,
XPoint a,
XPoint b,
XPoint c)
Checks if the point x lies in the triangle
a-b-c . |
void |
makeImmutable()
Makes this object immutable. |
void |
makeMutable()
Makes this object mutable. |
static XPoint |
max(XPoint a,
XPoint b)
Returns the bigger point according to the natural order defined by compareTo . |
static XPoint |
min(XPoint a,
XPoint b)
Returns the smaller point according to the natural order defined by compareTo . |
XPoint |
multiply(double m)
Multiplies this vector with m . |
double |
multiply(XPoint v)
Calculates the scalar product between this and v . |
double |
norm()
Return the euclidian norm of this point. |
XPoint |
normalize()
Returns a normalized point, that means: the new point has norm 1 and points to the same direction than this point. |
XPoint |
normalizeTo(double length)
Returns a vector (point) which points to the same direction as this but has norm length . |
static int |
opposite(int orientation)
Returns the 'opposite' (collinear) orientation constant to the given constant. |
static int |
orientation(double x1,
double y1,
double x2,
double y2,
double x,
double y)
Return an indicator of where the point (x,y) lies with
respect to the directed line (x1,y1)->(x2,y2) . |
int |
orientation(XPoint a,
XPoint b)
Return an indicator of where this point lies with respect
to the directed line a->b . |
static int |
orientation(XPoint a,
XPoint b,
XPoint c)
Return an indicator of where the point c lies with
respect to the directed line a->b . |
static int |
orientationColinear(double x1,
double y1,
double x2,
double y2,
double xp,
double yp)
Return an indicator of where the specified point (xp,yp) lies
with respect to the directed line segment (x1,y1)->(x2,y2) .
|
static int |
orientationColinear(XPoint a,
XPoint b,
XPoint c)
Return an indicator of where the specified point c lies
with respect to the directed line segment a->b .
|
void |
set(double x,
double y)
Changes the position of the point to (x,y) . |
static double |
signedArea(double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
Returns the signed area of the triangle (x1,y1)-(x2,y2)-(x3,y3) .
|
static double |
signedArea(XPoint a,
XPoint b,
XPoint c)
Returns the signed area of the triangle a-b-c .
|
XPoint |
subtract(XPoint v)
Substracts v from this vector. |
java.lang.String |
toString_complete()
Returns a more detailed string representation of the object than toString() . |
java.lang.String |
toString()
Returns a string representation of the object. |
XObject |
transform(double m00,
double m01,
double m02,
double m10,
double m11,
double m12)
Transforms this XObject by the given affine
transformation matrix. |
double |
x()
Return the X-coordinate value. |
double |
y()
Return the Y-coordinate value. |
Methods inherited from class gishur.x2.core.XObject |
checkState, checkStateCleared, clearDirty, clearState, clone, copy, dirty, getMutable, inverseTransform, lock, locked, modify, mutable, restoreMutability, rotate, scale, setState, state, state, toString_state, transform, translate, translate, unlock |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int ORIENTATION_LEFT
public static final int ORIENTATION_COLLINEAR
public static final int ORIENTATION_RIGHT
public static final int ORIENTATION_UNDEFINED
public static final int LIES_BEFORE
public static final int LIES_BETWEEN
public static final int LIES_BEHIND
public static final double IDENTICAL
public static final XPoint ORIGIN
Constructor Detail |
public XPoint(double x, double y)
x
- X-Coordinatey
- Y-CoordinateMethod Detail |
public static XPoint create(double x, double y)
public static XPoint createPolar(double angle, double length)
public static XPoint createMiddle(XPoint a, XPoint b)
this
point
and p
.this
and p
public java.lang.String toString()
toString
in class XObject
public java.lang.String toString_complete()
toString()
.toString_complete
in class XObject
public void makeMutable()
this
Object
can modify its coordinates (and some other geometric
information). This must be assured by every subclass of XObject
itself - but propagation to all XObject members contained by
this class (returned by getXObjectMembers()
) is assured
by this method.makeMutable
in class XObject
public void makeImmutable()
this
Object
cannot modify its coordinates (and some other geometric
information). This must be assured by every subclass of XObject
itself - but propagation to all XObject members contained by
this class (returned by getXObjectMembers()
) is assured
by this method.makeImmutable
in class XObject
protected XObject[] getXObjectMembers()
makeMutable()
, makeImmutable()
,
XObject.clearDirty()
, XObject.lock()
and XObject.unlock()
. To make this
work there must not occur circular dependencies.getXObjectMembers
in class XObject
null
if none).public double x()
public double y()
public double angle()
public boolean equals(double x, double y)
(x,y)
- Point to compare with this
.public boolean equals(XPoint p)
p
- Point to compare with this
.public boolean equals(java.lang.Object o)
this
and o
)
are equal.equals
in class java.lang.Object
o
- Object to compare with.public int compareTo(XPoint p)
p
is null
then a positive integer will be returned.Point a is less than point b if it has a smaller x-coordinate or - if both x-coordinates are equal - if it has a smaller y-coordinate than b.
p
- the XPoint
to be compared.public int compareTo(java.lang.Object o)
The implementor must ensure sgn(x.compareTo(y)) == -sgn(y.compareTo(x)) for all x and y. (This implies that x.compareTo(y) must throw an exception iff y.compareTo(x) throws an exception.)
The implementor must also ensure that the relation is transitive: (x.compareTo(y)>0 && y.compareTo(z)>0) implies x.compareTo(z)>0.
The implementer must also ensure that x.equals(y) implies that x.compareTo(y)==0. Note that the converse is not necessarily true (e.g., BigDecimal).
Finally, the implementer must ensure that x.compareTo(y)==0 implies that sgn(x.compareTo(z)) == sgn(y.compareTo(z)), for all z.
compareTo
in interface java12.lang.Comparable
o
- the Object
to be compared.ClassCastException
- the specified Object's type prevents it
from being compared to this Object.public static final XPoint min(XPoint a, XPoint b)
compareTo
. If the two points are equal,
a
will be returned. If one of the points is null
the other will be returned, if both are null
, null
will be returned.a
- first pointb
- second pointpublic static final XPoint max(XPoint a, XPoint b)
compareTo
. If the two points are equal,
a
will be returned. If the two points are equal,
a
will be returned. If one of the points is null
the other will be returned, if both are null
, null
will be returned.a
- first pointb
- second pointpublic double norm()
public static final double distanceSq(double x1, double y1, double x2, double y2)
x1,y1
- the first point (x1,y1)
x2,y2
- the second point (x2,y2)
(x1,y1)
and
(x2,y2)
.public static final double distance(double x1, double y1, double x2, double y2)
x1,y1
- the first point (x1,y1)
x2,y2
- the second point (x2,y2)
(x1,y1)
and (x2,y2)
.public static final double distanceSq(XPoint a, XPoint b)
a
- the first pointb
- the second pointa
and b
.public static final double distance(XPoint a, XPoint b)
a
- the first pointb
- the second pointa
and b
.public double distanceSq(XPoint p)
p
.p
- the other pointthis
and p
.public double distance(XPoint p)
p
.p
- the other pointthis
and p
.public static double angle(double x, double y)
(0,0)-(x,y)
and the x-axe.x,y
- coordinates of the point(+inf,0)-(0,0)-(x,y)
.public static final double angle(double x, double y, double x1, double y1, double x2, double y2)
(x1,y1)-(x,y)-(x2,y2)
(in Radiant). The angle will
be positive and measured counterclockwise.(x1,y1),(x2,y2)
- endpoints of the anglesides(x1,y1)-(x,y)-(x2,y2)
.public double angle(XPoint q, XPoint r)
q-this-r
(in Radiant). The angle will
be positive and measured counterclockwise.q,r
- endpoints of the anglesidesq-this-r
.public double angle(XPoint q)
this
and
q
with the abscissa (x-axis). The angle will be
positive and measured counterclockwise.q
- othe point defining one anglesidepublic static final int orientation(double x1, double y1, double x2, double y2, double x, double y)
(x,y)
lies with
respect to the directed line (x1,y1)->(x2,y2)
. The value will
be ORIENTATION_LEFT
if (x,y)
lies left of,
ORIENTATION_RIGHT
if it lies right of (x1,y1)->(x2,y2)
,
or ORIENTATION_COLLINEAR
if (x1,y1),(x2,y2),(x,y)
are collinear.
ORIENTATION_UNDEFINED
will be returned only if the points
(x1,y1)
and (x2,y2)
are equal and (x,y)
not.(x1,y1),(x2,y2),(x,y)
- the three pointsORIENTATION_LEFT
, ORIENTATION_RIGHT
, ORIENTATION_COLLINEAR
,
ORIENTATION_UNDEFINED
}).public static final int orientation(XPoint a, XPoint b, XPoint c) throws GeomException
c
lies with
respect to the directed line a->b
. The value will
be ORIENTATION_LEFT
if c
lies left of,
ORIENTATION_RIGHT
if it lies right of a->b
,
or ORIENTATION_COLLINEAR
if a,b,c
are collinear.
If any given point is null
then a
GeomException
is thrown.a,b,c
- the three pointsORIENTATION_LEFT
,ORIENTATION_RIGHT
,
ORIENTATION_COLLINEAR
}).GeomException
- if any argument is null
public static final int orientationColinear(double x1, double y1, double x2, double y2, double xp, double yp)
(xp,yp)
lies
with respect to the directed line segment (x1,y1)->(x2,y2)
.
If the three points are collinear, the result value will be LIES_BEFORE
if (xp,yp)
lies before (x1,y1)->(x2,y2)
,
LIES_BEHIND
if it lies behind (x1,y1)->(x2,y2)
or
LIES_BETWEEN
if it lies in the segment (x1,y1)-(x2,y2)
.
If the points are not collinear the result is worthless.(x1,y1),(x2,y2),(xp,yp)
- the three pointsLIES_BEFORE
,LIES_BEHIND
,
LIES_BETWEEN
}).public static final int orientationColinear(XPoint a, XPoint b, XPoint c)
c
lies
with respect to the directed line segment a->b
.
If the three points are collinear, the result value will be LIES_BEFORE
if c
lies before a->b
,
LIES_BEHIND
if it lies behind a->b
or
LIES_BETWEEN
if it lies in the segment a-b
.
If the points are not collinear the result is worthless.a,b,c
- the three pointsLIES_BEFORE
,LIES_BEHIND
,
LIES_BETWEEN
}).GeomException
- if any argument is null
public int orientation(XPoint a, XPoint b) throws GeomException
this
point lies with respect
to the directed line a->b
.a,b
- the other two pointsORIENTATION_LEFT
,ORIENTATION_RIGHT
,
ORIENTATION_COLLINEAR
}).GeomException
- if any argument is null
public static final int opposite(int orientation)
orientation
- given orientation constantpublic static final boolean inSector(double x, double y, double x0, double y0, double x1, double y1, double x2, double y2)
(x,y)
lies in the (convex) sector
(x1,y1)-(x0,y0)-(x2,y2)
(with apex (x0,y0)
).x,y
- test pointx0,y0
- apexx1,y1
- first vertexx2,y2
- second vertexpublic static final boolean inSector(XPoint x, XPoint p, XPoint a, XPoint b)
x
lies in the (convex) sector
a-p-b
(with apex p
).x
- test pointp
- apexa
- first vertexb
- second vertexGeomException
- if any argument is null
public static final boolean inTria(double x, double y, double x1, double y1, double x2, double y2, double x3, double y3)
(x,y)
lies in the triangle
(x1,y1)-(x2,y2)-(x3,y3)
.x,y
- test pointx1,y1
- first vertexx2,y2
- second vertexx3,y3
- third vertexpublic static final boolean inTria(XPoint x, XPoint a, XPoint b, XPoint c)
x
lies in the triangle
a-b-c
.x
- test pointa
- first vertexb
- second vertexc
- third vertexGeomException
- if any argument is null
public static final double signedArea(double x1, double y1, double x2, double y2, double x3, double y3)
(x1,y1)-(x2,y2)-(x3,y3)
.
The value is positive if the points are arranged counterclockwise.x1,y1
- first vertexx2,y2
- second vertexx3,y3
- third vertexpublic static final double signedArea(XPoint a, XPoint b, XPoint c)
a-b-c
.
The value is positive if the points are arranged counterclockwise.a
- first vertexb
- second vertexc
- third vertexGeomException
- if any argument is null
public XPoint normalize()
public XPoint normalizeTo(double length)
this
but has norm length
.length
- vector length to normalize topublic XPoint add(XPoint v)
this
vector to v
.v
- second vectorthis
and v
.public XPoint subtract(XPoint v)
v
from this
vector.v
- second vectorthis
and v
.public XPoint multiply(double m)
this
vector with m
.m
- multipierpublic double multiply(XPoint v)
this
and v
.v
- other vectorpublic void set(double x, double y)
(x,y)
. If the
object is immutable, a GeomException will be thrown.GeomException
- if point is immutablepublic XObject transform(double m00, double m01, double m02, double m10, double m11, double m12)
this
XObject by the given affine
transformation matrix.transform
in class XObject
m00,m01,m02
- first row of the transformation matrixm10,m11,m12
- second row of the transformation matrixthis
, only if it is
mutable)public java.lang.Object getOldXObject()
getOldXObject
in class XObject
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |