|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.partnersoft.geometry.xy.XyPoint
public class XyPoint
A 2-dimensional point in x, y space.
Copyright 2006-2007
| Constructor Summary | |
|---|---|
XyPoint(Cog state)
|
|
XyPoint(double x,
double y)
|
|
| Method Summary | |
|---|---|
double |
distanceFrom(XyPoint nother)
Returns the straight-line distance between this point and the one given. |
double |
distanceSquaredFrom(XyPoint nother)
Returns the square of the straight-line distance between this point and the one given. |
boolean |
equals(java.lang.Object nother)
|
boolean |
equals(java.lang.Object nother,
double epsilon)
Fuzzier than equals, returns true if both x and y are within epsilon of each other. |
XyBounds |
getBounds()
Returns an XyBounds object representing the rectangular extents of this shape. |
double |
getX()
X coordinate. |
double |
getY()
Y coordinate. |
int |
hashCode()
|
java.util.Iterator<XyPoint> |
iterator()
|
XyPoint |
minus(XyPoint nother)
Returns the offset, or two-dimensional difference, between this point and the other. |
XyPoint |
plus(XyPoint nother)
Returns the two-dimensional sum of this point and the one given. |
XyPoint |
scaledBy(double scale)
Return a scaled version of the shape by multiplying all coordinates by the given factor in both dimensions. |
XyPoint |
scaledBy(double scaleX,
double scaleY)
|
XyPoint |
shoot(double distance,
XyDirection direction)
Computes a new point using a distance and direction. |
XyPoint |
shoot(XyVector vector)
Computes a new point using a vector. |
XyPoint |
snappedToGrid(double gridSize)
|
XyPoint |
times(double factor)
Multiplies both x and y by the given factor and returns the result. |
Cog |
toCog()
Returns the complete internal state of this object in the form of a Cog. |
XyPolar |
toPolar()
Converts the point to polar representation. |
java.lang.String |
toString()
|
XyVector |
toVector()
Converts the point to a vector from the origin (0, 0). |
XyShape |
transformedBy(XyTransform transform)
Transform the shape using the given transform. |
XyPoint |
translatedBy(double offsetX,
double offsetY)
Translate the shape by adding all coordinates to the given x and y offsets. |
XyVector |
vectorFrom(XyPoint nother)
Returns the two-dimensional vector offset between this point and the one given. |
XyVector |
vectorTo(XyPoint nother)
Returns the two-dimensional vector offset between the point given and this point. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public XyPoint(double x,
double y)
public XyPoint(Cog state)
| Method Detail |
|---|
public double distanceFrom(XyPoint nother)
nother - other point to measure from
public XyVector vectorFrom(XyPoint nother)
nother - other point to measure from
public XyVector vectorTo(XyPoint nother)
nother - other point to measure from
public double distanceSquaredFrom(XyPoint nother)
nother - other point to measure from
public XyPoint plus(XyPoint nother)
public XyPoint minus(XyPoint nother)
nother - point to calculate offset from
public XyPoint times(double factor)
public XyPoint shoot(double distance,
XyDirection direction)
public XyPoint shoot(XyVector vector)
public XyPoint snappedToGrid(double gridSize)
public XyPolar toPolar()
public XyVector toVector()
public XyPoint scaledBy(double scale)
XyShape
scaledBy in interface XyShape<XyPoint>scale - scaling factor
public XyPoint scaledBy(double scaleX,
double scaleY)
public XyPoint translatedBy(double offsetX,
double offsetY)
XyShape
translatedBy in interface XyShape<XyPoint>offsetX - offset for the x dimensionoffsetY - offset for the y dimension
public XyShape transformedBy(XyTransform transform)
XyShape
transformedBy in interface XyShape<XyPoint>transform - affine transform to apply.
public java.util.Iterator<XyPoint> iterator()
iterator in interface java.lang.Iterable<XyPoint>public Cog toCog()
CoggableCog.
toCog in interface Coggablepublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object nother)
equals in class java.lang.Object
public boolean equals(java.lang.Object nother,
double epsilon)
nother - epsilon -
public XyBounds getBounds()
XyShape
getBounds in interface XyShape<XyPoint>public int hashCode()
hashCode in class java.lang.Objectpublic double getX()
public double getY()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||