public class Point extends org.mini2Dx.gdx.math.Vector2 implements Positionable
Vector2
with additional functionalityModifier and Type | Field and Description |
---|---|
protected org.mini2Dx.gdx.utils.Array<PositionChangeListener> |
positionChangeListeners |
Constructor and Description |
---|
Point()
Constructs a new
Point at 0,0 |
Point(float x,
float y)
Constructs a new
Point at a specific coordinate |
Point(Geometry geometry)
|
Point(Point point)
|
Modifier and Type | Method and Description |
---|---|
org.mini2Dx.gdx.math.Vector2 |
add(float x,
float y) |
org.mini2Dx.gdx.math.Vector2 |
add(org.mini2Dx.gdx.math.Vector2 v) |
<T extends Positionable> |
addPostionChangeListener(PositionChangeListener<T> listener)
Adds a
Positionable to be notified of coordinate
changes |
protected void |
clearPositionChangeListeners() |
Point |
copy() |
void |
dispose()
|
boolean |
equals(float x,
float y,
float delta)
Determines if a coordinate is nearly equal to this one.
|
boolean |
equals(org.mini2Dx.gdx.math.Vector2 v)
Determines if another
Vector2 is exactly equal to this one |
boolean |
equals(org.mini2Dx.gdx.math.Vector2 v,
float delta)
Determines if this and a
Vector2 are nearly equal. |
float |
getDistanceTo(float x,
float y)
Returns this distance between this object's x,y coordinates and the
provided xy coordinates
|
float |
getDistanceTo(Positionable positionable)
Returns this distance between this object's x,y coordinates and the
provided
Positionable 's xy coordinates |
float |
getX()
Returns the x coordinate of this object
|
float |
getY()
Returns the y coordinate of this object
|
boolean |
isOnLineBetween(Point a,
Point b)
Returns if this
Point is between a and b on a line |
void |
moveTowards(float x,
float y,
float speed)
Moves this
Positionable towards a coordinate |
void |
moveTowards(Positionable positionable,
float speed)
Moves this
Positionable towards another Positionable |
org.mini2Dx.gdx.math.Vector2 |
mul(org.mini2Dx.gdx.math.Matrix3 mat) |
org.mini2Dx.gdx.math.Vector2 |
mulAdd(org.mini2Dx.gdx.math.Vector2 vec,
float scalar) |
org.mini2Dx.gdx.math.Vector2 |
mulAdd(org.mini2Dx.gdx.math.Vector2 vec,
org.mini2Dx.gdx.math.Vector2 mulVec) |
protected void |
notifyPositionChangeListeners() |
<T extends Positionable> |
removePositionChangeListener(PositionChangeListener<T> listener)
Removes a
PositionChangeListener to stop it being notified of
coordinate changes |
void |
rotateAround(float centerX,
float centerY,
float degrees)
Rotates this
Point around a coordinate |
void |
rotateAround(Point center,
float degrees)
|
org.mini2Dx.gdx.math.Vector2 |
scl(float scalar) |
org.mini2Dx.gdx.math.Vector2 |
scl(float x,
float y) |
org.mini2Dx.gdx.math.Vector2 |
scl(org.mini2Dx.gdx.math.Vector2 v) |
org.mini2Dx.gdx.math.Vector2 |
set(float x,
float y) |
org.mini2Dx.gdx.math.Vector2 |
set(org.mini2Dx.gdx.math.Vector2 v) |
void |
setX(float x)
Sets the x coordinate of this object
|
void |
setXY(float x,
float y)
Sets the x and y coordinate of this object
|
void |
setY(float y)
Sets the y coordinate of this object
|
org.mini2Dx.gdx.math.Vector2 |
sub(float x,
float y) |
org.mini2Dx.gdx.math.Vector2 |
sub(org.mini2Dx.gdx.math.Vector2 v) |
angle, angle, angleRad, angleRad, clamp, cpy, crs, crs, dot, dot, dot, dst, dst, dst, dst2, dst2, dst2, epsilonEquals, epsilonEquals, epsilonEquals, epsilonEquals, equals, fromString, hashCode, hasOppositeDirection, hasSameDirection, interpolate, isCollinear, isCollinear, isCollinearOpposite, isCollinearOpposite, isOnLine, isOnLine, isPerpendicular, isPerpendicular, isUnit, isUnit, isZero, isZero, len, len, len2, len2, lerp, limit, limit2, nor, rotate, rotate90, rotateRad, setAngle, setAngleRad, setLength, setLength2, setToRandomDirection, setZero, toString
protected org.mini2Dx.gdx.utils.Array<PositionChangeListener> positionChangeListeners
public Point()
Point
at 0,0public Point(float x, float y)
Point
at a specific coordinatex
- The x coordinatey
- The y coordinatepublic void dispose()
public float getDistanceTo(float x, float y)
Positionable
getDistanceTo
in interface Positionable
x
- The x coordinate to measure distance toy
- The y coordinate to measure distance topublic float getDistanceTo(Positionable positionable)
Positionable
Positionable
's xy coordinatesgetDistanceTo
in interface Positionable
positionable
- The Positionable
to retrieve the distance frompublic void moveTowards(float x, float y, float speed)
Positionable
Positionable
towards a coordinatemoveTowards
in interface Positionable
x
- The target x coordinatey
- The target y coordinatespeed
- The amount to move bypublic void moveTowards(Positionable positionable, float speed)
Positionable
Positionable
towards another Positionable
moveTowards
in interface Positionable
positionable
- The target Positionable
speed
- The amount to move bypublic <T extends Positionable> void addPostionChangeListener(PositionChangeListener<T> listener)
Positionable
Positionable
to be notified of coordinate
changesaddPostionChangeListener
in interface Positionable
listener
- The PositionChangeListener
to addPositionable.addPostionChangeListener(PositionChangeListener)
public <T extends Positionable> void removePositionChangeListener(PositionChangeListener<T> listener)
Positionable
PositionChangeListener
to stop it being notified of
coordinate changesremovePositionChangeListener
in interface Positionable
listener
- The PositionChangeListener
to removePositionable.removePositionChangeListener(PositionChangeListener)
protected void notifyPositionChangeListeners()
protected void clearPositionChangeListeners()
public void rotateAround(Point center, float degrees)
center
- The Point
to rotate arounddegrees
- The angle to rotate by in degreespublic void rotateAround(float centerX, float centerY, float degrees)
Point
around a coordinatecenterX
- The x coordinate to rotate aroundcenterY
- The y coordinate to rotate arounddegrees
- The angle to rotate by in degreespublic boolean isOnLineBetween(Point a, Point b)
Point
is between a and b on a linepublic boolean equals(org.mini2Dx.gdx.math.Vector2 v)
Vector2
is exactly equal to this onev
- The Vector2
to compare toVector2
s x and y are exactly equalpublic boolean equals(org.mini2Dx.gdx.math.Vector2 v, float delta)
Vector2
are nearly equal. A delta of 0.1
means 0.0 and 0.1 would be considered equal but 0.0 and 0.11 would not.v
- The Vector2
to compare todelta
- The amount of error to allow for.public boolean equals(float x, float y, float delta)
x
- The x coordinatey
- The y coordinatedelta
- The amount of error to allow for.public float getX()
Positionable
getX
in interface Positionable
public float getY()
Positionable
getY
in interface Positionable
public void setX(float x)
Positionable
setX
in interface Positionable
x
- The x coordinatepublic void setY(float y)
Positionable
setY
in interface Positionable
y
- The y coordinatepublic void setXY(float x, float y)
Positionable
setXY
in interface Positionable
x
- The x coordinatey
- The y coordinatepublic org.mini2Dx.gdx.math.Vector2 set(float x, float y)
set
in class org.mini2Dx.gdx.math.Vector2
public org.mini2Dx.gdx.math.Vector2 add(float x, float y)
add
in class org.mini2Dx.gdx.math.Vector2
public org.mini2Dx.gdx.math.Vector2 sub(float x, float y)
sub
in class org.mini2Dx.gdx.math.Vector2
public org.mini2Dx.gdx.math.Vector2 mul(org.mini2Dx.gdx.math.Matrix3 mat)
mul
in class org.mini2Dx.gdx.math.Vector2
public org.mini2Dx.gdx.math.Vector2 mulAdd(org.mini2Dx.gdx.math.Vector2 vec, float scalar)
mulAdd
in interface org.mini2Dx.gdx.math.Vector<org.mini2Dx.gdx.math.Vector2>
mulAdd
in class org.mini2Dx.gdx.math.Vector2
public org.mini2Dx.gdx.math.Vector2 mulAdd(org.mini2Dx.gdx.math.Vector2 vec, org.mini2Dx.gdx.math.Vector2 mulVec)
mulAdd
in interface org.mini2Dx.gdx.math.Vector<org.mini2Dx.gdx.math.Vector2>
mulAdd
in class org.mini2Dx.gdx.math.Vector2
public org.mini2Dx.gdx.math.Vector2 scl(org.mini2Dx.gdx.math.Vector2 v)
scl
in interface org.mini2Dx.gdx.math.Vector<org.mini2Dx.gdx.math.Vector2>
scl
in class org.mini2Dx.gdx.math.Vector2
public org.mini2Dx.gdx.math.Vector2 scl(float scalar)
scl
in interface org.mini2Dx.gdx.math.Vector<org.mini2Dx.gdx.math.Vector2>
scl
in class org.mini2Dx.gdx.math.Vector2
public org.mini2Dx.gdx.math.Vector2 scl(float x, float y)
scl
in class org.mini2Dx.gdx.math.Vector2
public org.mini2Dx.gdx.math.Vector2 set(org.mini2Dx.gdx.math.Vector2 v)
set
in interface org.mini2Dx.gdx.math.Vector<org.mini2Dx.gdx.math.Vector2>
set
in class org.mini2Dx.gdx.math.Vector2
public org.mini2Dx.gdx.math.Vector2 add(org.mini2Dx.gdx.math.Vector2 v)
add
in interface org.mini2Dx.gdx.math.Vector<org.mini2Dx.gdx.math.Vector2>
add
in class org.mini2Dx.gdx.math.Vector2
public org.mini2Dx.gdx.math.Vector2 sub(org.mini2Dx.gdx.math.Vector2 v)
sub
in interface org.mini2Dx.gdx.math.Vector<org.mini2Dx.gdx.math.Vector2>
sub
in class org.mini2Dx.gdx.math.Vector2
public Point copy()