Clearable
, EpsilonComparable<Point2D32>
, GeometricallyComparable<Point2D32>
, GeometryObject<Point2D32>
, Settable<Point2D32>
, Transformable
, Point2DBasics
, Point2DReadOnly
, Tuple2DBasics
, Tuple2DReadOnly
public class Point2D32 extends java.lang.Object implements Point2DBasics, GeometryObject<Point2D32>
This version of 2D point uses single precision fields to save the value of each component. It is
meant for garbage free usage and for situations where heap memory is limited. When memory is not
a constraint, the use of Point2D
is preferable.
Constructor | Description |
---|---|
Point2D32() |
Creates a new point and initializes it coordinates to zero.
|
Point2D32(float[] pointArray) |
Creates a new point and initializes its component
x , y in order from the given
array. |
Point2D32(float x,
float y) |
Creates a new point and initializes it with the given coordinates.
|
Point2D32(Tuple2DReadOnly other) |
Creates a new point and initializes it to
other . |
Modifier and Type | Method | Description |
---|---|---|
boolean |
epsilonEquals(Point2D32 other,
double epsilon) |
Tests on a per component basis if this point is equal to the given
other to an
epsilon . |
boolean |
equals(java.lang.Object object) |
Tests if the given
object 's class is the same as this, in which case the method
returns Tuple2DReadOnly.equals(Tuple2DReadOnly) , it returns false otherwise. |
boolean |
geometricallyEquals(Point2D32 other,
double epsilon) |
Tests if
this and other represent the same point 2D to an epsilon . |
double |
getX() |
Returns the value of the x-coordinate of this point.
|
float |
getX32() |
Returns the value of the x-coordinate of this point.
|
double |
getY() |
Returns the value of the y-coordinate of this point.
|
float |
getY32() |
Returns the value of the y-coordinate of this point.
|
int |
hashCode() |
Calculates and returns a hash code value from the value of each component of this point 2D.
|
void |
set(Point2D32 other) |
Sets this point to
other . |
void |
setX(double x) |
Sets the x-coordinate of this point.
|
void |
setX(float x) |
Sets the x-coordinate of this point.
|
void |
setY(double y) |
Sets the y-coordinate of this point.
|
void |
setY(float y) |
Sets the y-coordinate of this point.
|
java.lang.String |
toString() |
Provides a
String representation of this point 2D as follows: (x, y). |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
applyInverseTransform, applyInverseTransform, applyTransform, applyTransform
distance, distanceFromOrigin, distanceFromOriginSquared, distanceSquared, distanceXY, distanceXYSquared, geometricallyEquals
absolute, add, add, add, addX, addY, clipToMax, clipToMin, clipToMinMax, containsNaN, interpolate, interpolate, negate, scale, scale, scaleAdd, scaleAdd, scaleSub, scaleSub, set, set, set, set, set, set, set, set, set, set, setAndAbsolute, setAndClipToMax, setAndClipToMin, setAndClipToMinMax, setAndNegate, setAndScale, setElement, setToNaN, setToZero, sub, sub, sub, subX, subY
epsilonEquals, equals, get, get, get, get, get, get, get, getElement, getElement32
public Point2D32()
public Point2D32(float x, float y)
x
- the x-coordinate.y
- the y-coordinate.public Point2D32(float[] pointArray)
x
, y
in order from the given
array.pointArray
- the array containing this point's coordinates. Not modified.public Point2D32(Tuple2DReadOnly other)
other
.other
- the tuple to copy the coordinates from. Not modified.public void set(Point2D32 other)
other
.public void setX(double x)
setX
in interface Tuple2DBasics
x
- the x-coordinate.public void setY(double y)
setY
in interface Tuple2DBasics
y
- the y-coordinate.public void setX(float x)
x
- the x-coordinate.public void setY(float y)
y
- the y-coordinate.public double getX()
getX
in interface Tuple2DReadOnly
public double getY()
getY
in interface Tuple2DReadOnly
public float getX32()
getX32
in interface Tuple2DReadOnly
public float getY32()
getY32
in interface Tuple2DReadOnly
public boolean equals(java.lang.Object object)
object
's class is the same as this, in which case the method
returns Tuple2DReadOnly.equals(Tuple2DReadOnly)
, it returns false
otherwise.equals
in class java.lang.Object
object
- the object to compare against this. Not modified.true
if object
and this are exactly equal, false
otherwise.public boolean epsilonEquals(Point2D32 other, double epsilon)
other
to an
epsilon
.epsilonEquals
in interface EpsilonComparable<Point2D32>
other
- the other point to compare against this. Not modified.epsilon
- the tolerance to use when comparing each component.true
if the two tuples are equal, false
otherwise.public boolean geometricallyEquals(Point2D32 other, double epsilon)
this
and other
represent the same point 2D to an epsilon
.
Two points are considered geometrically equal if they are at a distance of less than or equal
to epsilon
.
Note that this.geometricallyEquals(other, epsilon) == true
does not necessarily imply
this.epsilonEquals(other, epsilon)
and vice versa.
geometricallyEquals
in interface GeometricallyComparable<Point2D32>
other
- the other point 2D to compare against this. Not modified.epsilon
- the maximum distance that the two points can be spaced and still considered
equal.true
if the two points represent the same geometry, false
otherwise.public java.lang.String toString()
String
representation of this point 2D as follows: (x, y).toString
in class java.lang.Object
String
representing this point 2D.public int hashCode()
hashCode
in class java.lang.Object