| Constructor and Description |
|---|
XyPoint(Cog state) |
XyPoint(double x,
double y) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
public XyPoint(double x,
double y)
public XyPoint(Cog state)
public double distanceFrom(XyPoint nother)
nother - other point to measure frompublic XyVector vectorFrom(XyPoint nother)
nother - other point to measure frompublic XyVector vectorTo(XyPoint nother)
nother - other point to measure frompublic double distanceSquaredFrom(XyPoint nother)
nother - other point to measure frompublic XyPoint plus(XyPoint nother)
public XyPoint minus(XyPoint nother)
nother - point to calculate offset frompublic XyPoint times(double factor)
public XyPoint shoot(double distance, XyDirection direction)
public XyPoint snappedToGrid(double gridSize)
public XyPolar toPolar()
public XyVector toVector()
public XyPoint scaledBy(double scale)
XyShapepublic XyPoint scaledBy(double scaleX, double scaleY)
public XyPoint translatedBy(double offsetX, double offsetY)
XyShapetranslatedBy in interface XyShape<XyPoint>offsetX - offset for the x dimensionoffsetY - offset for the y dimensionpublic XyShape transformedBy(XyTransform transform)
XyShapetransformedBy 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.public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object nother)
equals in class java.lang.Objectpublic boolean equals(java.lang.Object nother,
double epsilon)
nother - epsilon - public XyBounds getBounds()
XyShapepublic int hashCode()
hashCode in class java.lang.Objectpublic double getX()
public double getY()