Class PointI2
java.lang.Object
com.badlogic.gdx.math.GridPoint2
com.github.tommyettinger.gand.points.PointI2
- All Implemented Interfaces:
com.badlogic.gdx.utils.Json.Serializable
,com.github.tommyettinger.crux.Point2<PointI2>
,com.github.tommyettinger.crux.PointN<PointI2>
,Serializable
public class PointI2
extends com.badlogic.gdx.math.GridPoint2
implements com.github.tommyettinger.crux.Point2<PointI2>, com.badlogic.gdx.utils.Json.Serializable
The same as
GridPoint2
, just implementing Point2
and Json.Serializable
.- See Also:
-
Field Summary
Fields inherited from class com.badlogic.gdx.math.GridPoint2
x, y
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionadd
(int x, int y) Adds another x,y,z point to this point.add
(com.badlogic.gdx.math.GridPoint2 other) Adds another point to this point.cpy()
float
float
boolean
Returns true if this type of point usesfloat
ordouble
for its components, or false otherwise.fromString
(String v) Sets thisPointI2
to the value represented by the specified string according to the format oftoString()
.int
hashCode()
boolean
isUnit()
boolean
isUnit
(float v) boolean
isZero()
boolean
isZero
(float v) float
len2()
void
read
(com.badlogic.gdx.utils.Json json, com.badlogic.gdx.utils.JsonValue jsonData) set
(float x, float y) set
(int x, int y) Sets the coordinates of this PointI2.set
(com.badlogic.gdx.math.GridPoint2 point) Sets the coordinates of this point to that of another.set
(com.github.tommyettinger.crux.Point2<?> pt) setZero()
sub
(int x, int y) Subtracts another x,y,z point from this point.sub
(com.badlogic.gdx.math.GridPoint2 other) Subtracts another point from this point.toString()
Converts thisPointI2
to a string in the format(x,y,z)
.void
write
(com.badlogic.gdx.utils.Json json) float
x()
x
(float next) float
y()
y
(float next) Methods inherited from class com.badlogic.gdx.math.GridPoint2
dst, dst, dst2, dst2, equals
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.github.tommyettinger.crux.Point2
rank
Methods inherited from interface com.github.tommyettinger.crux.PointN
len, mutable
-
Constructor Details
-
PointI2
public PointI2() -
PointI2
public PointI2(int x, int y) -
PointI2
public PointI2(float x, float y) -
PointI2
public PointI2(com.badlogic.gdx.math.GridPoint2 v) -
PointI2
public PointI2(com.badlogic.gdx.math.Vector2 v) -
PointI2
-
PointI2
public PointI2(com.github.tommyettinger.crux.Point2<? extends com.github.tommyettinger.crux.Point2<?>> v)
-
-
Method Details
-
floatingPoint
public boolean floatingPoint()Returns true if this type of point usesfloat
ordouble
for its components, or false otherwise. This always returns false.- Specified by:
floatingPoint
in interfacecom.github.tommyettinger.crux.PointN<PointI2>
- Returns:
- false
-
cpy
- Specified by:
cpy
in interfacecom.github.tommyettinger.crux.PointN<PointI2>
- Overrides:
cpy
in classcom.badlogic.gdx.math.GridPoint2
-
len2
public float len2()- Specified by:
len2
in interfacecom.github.tommyettinger.crux.PointN<PointI2>
-
set
- Specified by:
set
in interfacecom.github.tommyettinger.crux.PointN<PointI2>
-
sub
- Specified by:
sub
in interfacecom.github.tommyettinger.crux.PointN<PointI2>
-
add
- Specified by:
add
in interfacecom.github.tommyettinger.crux.PointN<PointI2>
-
scl
- Specified by:
scl
in interfacecom.github.tommyettinger.crux.PointN<PointI2>
-
dst
- Specified by:
dst
in interfacecom.github.tommyettinger.crux.PointN<PointI2>
-
dst2
- Specified by:
dst2
in interfacecom.github.tommyettinger.crux.PointN<PointI2>
-
isUnit
public boolean isUnit()- Specified by:
isUnit
in interfacecom.github.tommyettinger.crux.PointN<PointI2>
-
isUnit
public boolean isUnit(float v) - Specified by:
isUnit
in interfacecom.github.tommyettinger.crux.PointN<PointI2>
-
isZero
public boolean isZero()- Specified by:
isZero
in interfacecom.github.tommyettinger.crux.PointN<PointI2>
-
isZero
public boolean isZero(float v) - Specified by:
isZero
in interfacecom.github.tommyettinger.crux.PointN<PointI2>
-
setZero
- Specified by:
setZero
in interfacecom.github.tommyettinger.crux.PointN<PointI2>
-
x
public float x()- Specified by:
x
in interfacecom.github.tommyettinger.crux.Point2<PointI2>
-
x
- Specified by:
x
in interfacecom.github.tommyettinger.crux.Point2<PointI2>
-
y
public float y()- Specified by:
y
in interfacecom.github.tommyettinger.crux.Point2<PointI2>
-
y
- Specified by:
y
in interfacecom.github.tommyettinger.crux.Point2<PointI2>
-
set
- Specified by:
set
in interfacecom.github.tommyettinger.crux.Point2<PointI2>
-
set
Sets the coordinates of this point to that of another.- Overrides:
set
in classcom.badlogic.gdx.math.GridPoint2
- Parameters:
point
- The 2D grid point (which may be a PointI2 or GridPoint2) to copy coordinates of.- Returns:
- this PointI2 for chaining.
-
set
Sets the coordinates of this PointI2.- Overrides:
set
in classcom.badlogic.gdx.math.GridPoint2
- Parameters:
x
- X coordinatey
- Y coordinate- Returns:
- this PointI2 for chaining.
-
set
-
add
Adds another point to this point.- Overrides:
add
in classcom.badlogic.gdx.math.GridPoint2
- Parameters:
other
- The other point- Returns:
- this PointI2 for chaining.
-
add
Adds another x,y,z point to this point.- Overrides:
add
in classcom.badlogic.gdx.math.GridPoint2
- Parameters:
x
- The x-coordinate of the other pointy
- The y-coordinate of the other point- Returns:
- this PointI2 for chaining.
-
sub
Subtracts another point from this point.- Overrides:
sub
in classcom.badlogic.gdx.math.GridPoint2
- Parameters:
other
- The other point- Returns:
- this PointI2 for chaining.
-
sub
Subtracts another x,y,z point from this point.- Overrides:
sub
in classcom.badlogic.gdx.math.GridPoint2
- Parameters:
x
- The x-coordinate of the other pointy
- The y-coordinate of the other point- Returns:
- this PointI2 for chaining.
-
hashCode
public int hashCode()- Overrides:
hashCode
in classcom.badlogic.gdx.math.GridPoint2
-
write
public void write(com.badlogic.gdx.utils.Json json) - Specified by:
write
in interfacecom.badlogic.gdx.utils.Json.Serializable
-
read
public void read(com.badlogic.gdx.utils.Json json, com.badlogic.gdx.utils.JsonValue jsonData) - Specified by:
read
in interfacecom.badlogic.gdx.utils.Json.Serializable
-
toString
Converts thisPointI2
to a string in the format(x,y,z)
.- Overrides:
toString
in classcom.badlogic.gdx.math.GridPoint2
- Returns:
- a string representation of this object.
-
fromString
Sets thisPointI2
to the value represented by the specified string according to the format oftoString()
.- Parameters:
v
- the string.- Returns:
- this vector for chaining
-