Package com.badlogic.gdx.math
Class GridPoint3
- java.lang.Object
-
- com.badlogic.gdx.math.GridPoint3
-
- All Implemented Interfaces:
java.io.Serializable
public class GridPoint3 extends java.lang.Object implements java.io.Serializable
A point in a 3D grid, with integer x and y coordinates- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description GridPoint3()
Constructs a 3D grid point with all coordinates pointing to the origin (0, 0, 0).GridPoint3(int x, int y, int z)
Constructs a 3D grid point.GridPoint3(GridPoint3 point)
Copy constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GridPoint3
add(int x, int y, int z)
Adds another 3D grid point to this point.GridPoint3
add(GridPoint3 other)
Adds another 3D grid point to this point.GridPoint3
cpy()
float
dst(int x, int y, int z)
float
dst(GridPoint3 other)
float
dst2(int x, int y, int z)
float
dst2(GridPoint3 other)
boolean
equals(java.lang.Object o)
int
hashCode()
GridPoint3
set(int x, int y, int z)
Sets the coordinates of this GridPoint3D.GridPoint3
set(GridPoint3 point)
Sets the coordinates of this 3D grid point to that of another.GridPoint3
sub(int x, int y, int z)
Subtracts another 3D grid point from this point.GridPoint3
sub(GridPoint3 other)
Subtracts another 3D grid point from this point.java.lang.String
toString()
-
-
-
Constructor Detail
-
GridPoint3
public GridPoint3()
Constructs a 3D grid point with all coordinates pointing to the origin (0, 0, 0).
-
GridPoint3
public GridPoint3(int x, int y, int z)
Constructs a 3D grid point.- Parameters:
x
- X coordinatey
- Y coordinatez
- Z coordinate
-
GridPoint3
public GridPoint3(GridPoint3 point)
Copy constructor- Parameters:
point
- The 3D grid point to make a copy of.
-
-
Method Detail
-
set
public GridPoint3 set(GridPoint3 point)
Sets the coordinates of this 3D grid point to that of another.- Parameters:
point
- The 3D grid point to copy coordinates of.- Returns:
- this GridPoint3 for chaining.
-
set
public GridPoint3 set(int x, int y, int z)
Sets the coordinates of this GridPoint3D.- Parameters:
x
- X coordinatey
- Y coordinatez
- Z coordinate- Returns:
- this GridPoint3D for chaining.
-
dst2
public float dst2(GridPoint3 other)
- Parameters:
other
- The other point- Returns:
- the squared distance between this point and the other point.
-
dst2
public float dst2(int x, int y, int z)
- Parameters:
x
- The x-coordinate of the other pointy
- The y-coordinate of the other pointz
- The z-coordinate of the other point- Returns:
- the squared distance between this point and the other point.
-
dst
public float dst(GridPoint3 other)
- Parameters:
other
- The other point- Returns:
- the distance between this point and the other vector.
-
dst
public float dst(int x, int y, int z)
- Parameters:
x
- The x-coordinate of the other pointy
- The y-coordinate of the other pointz
- The z-coordinate of the other point- Returns:
- the distance between this point and the other point.
-
add
public GridPoint3 add(GridPoint3 other)
Adds another 3D grid point to this point.- Parameters:
other
- The other point- Returns:
- this 3d grid point for chaining.
-
add
public GridPoint3 add(int x, int y, int z)
Adds another 3D grid point to this point.- Parameters:
x
- The x-coordinate of the other pointy
- The y-coordinate of the other pointz
- The z-coordinate of the other point- Returns:
- this 3d grid point for chaining.
-
sub
public GridPoint3 sub(GridPoint3 other)
Subtracts another 3D grid point from this point.- Parameters:
other
- The other point- Returns:
- this 3d grid point for chaining.
-
sub
public GridPoint3 sub(int x, int y, int z)
Subtracts another 3D grid point from this point.- Parameters:
x
- The x-coordinate of the other pointy
- The y-coordinate of the other pointz
- The z-coordinate of the other point- Returns:
- this 3d grid point for chaining.
-
cpy
public GridPoint3 cpy()
- Returns:
- a copy of this grid point
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-