public final class Point2i extends Object implements Serializable
We consider a point to be a tuple representing a single physical point in space.
Constructor and Description |
---|
Point2i() |
Point2i(int x,
int y) |
Point2i(Point2i point)
Creates with the same values as an existing
Point2i . |
Modifier and Type | Method and Description |
---|---|
void |
add(Point2i point)
Adds values from a
Point2i across each corresponding dimension. |
boolean |
equals(Object o) |
int |
hashCode() |
static Point2i |
immutableAdd(Point2i point1,
Point2i point2)
Adds two points immutably.
|
void |
incrementX()
Increments the X component's value by one.
|
void |
incrementX(int shift)
Increments the X component's value by a shift.
|
void |
incrementY()
Increments the Y component's value by one.
|
void |
incrementY(int shift)
Increments the Y component's value by a shift.
|
void |
setX(int x)
X-axis component of point.
|
void |
setY(int y)
Y-axis component of point.
|
double[] |
toArray()
Converts the point to an array.
|
String |
toString() |
int |
x()
X-axis component of point.
|
int |
y()
Y-axis component of point.
|
public Point2i(Point2i point)
Point2i
.point
- to copy values from.public Point2i(int x, int y)
public Point2i()
public int x()
public int y()
public void incrementX()
public void incrementY()
public void incrementX(int shift)
shift
- how much to increment by.public void incrementY(int shift)
shift
- how much to increment by.public void add(Point2i point)
Point2i
across each corresponding dimension.point
- the point whose values are added.public double[] toArray()
public static Point2i immutableAdd(Point2i point1, Point2i point2)
point1
- the first point to add.point2
- the second point to add.public void setX(int x)
public void setY(int y)
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.