public class GridPoint
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
int |
index
an integer useful for indexing this point: for instance, 'index' can be the number of a vertex
|
private int |
x
integer coordinates of the point on the grid
|
private int |
y
integer coordinates of the point on the grid
|
Constructor and Description |
---|
GridPoint()
Initialize an empty point
|
GridPoint(GridPoint p)
Make a copy of a point q
|
GridPoint(int x,
int y)
Initialize an integer point having coordinates (x, y)
|
Modifier and Type | Method and Description |
---|---|
int |
dimension() |
boolean |
equals(java.lang.Object o)
Check whether two points have equal coordinates
|
double |
euclideanDistance(GridPoint p)
Return the Euclidean distance between the current point 'this' and a point 'p'
|
int |
getCartesian(int dim)
Return the d-th coordinate of the point
|
int |
getX()
Return the x-coordinate
|
int |
getY()
Return the y-coordinate
|
int |
hashCode() |
int |
manhattanDistance(GridPoint p)
Return the Manhattan distance between the current point 'this' and a point 'p'
|
void |
setCartesian(int dim,
int x)
Set the d-th coordinate of the point
|
void |
setOrigin() |
void |
setX(int x)
Set the x-coordinate
|
void |
setY(int y)
Set the y-coordinate
|
int |
squareEuclideanDistance(GridPoint p)
Return the square of the Euclidean distance between the current point 'this' and a point 'p'
|
java.lang.String |
toString() |
void |
translateOf(int dx,
int dy)
Translate the current point of the vector (dx, dy)
|
public int index
private int x
private int y
public GridPoint()
public GridPoint(int x, int y)
public GridPoint(GridPoint p)
public int getX()
public int getY()
public void setX(int x)
public void setY(int y)
public void translateOf(int dx, int dy)
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public double euclideanDistance(GridPoint p)
public int manhattanDistance(GridPoint p)
public int squareEuclideanDistance(GridPoint p)
public java.lang.String toString()
toString
in class java.lang.Object
public int dimension()
public int getCartesian(int dim)
public void setCartesian(int dim, int x)
public void setOrigin()