- java.lang.Object
-
- org.arakhne.afc.math.geometry.d2.i.Tuple2i<Point2i>
-
- org.arakhne.afc.math.geometry.d2.i.Point2i
-
- All Implemented Interfaces:
Serializable,Cloneable,Point2D<Point2i,Vector2i>,Tuple2D<Point2i>,JsonableObject
- Direct Known Subclasses:
OrientedPoint2i
public class Point2i extends Tuple2i<Point2i> implements Point2D<Point2i,Vector2i>
2D Point with 2 integer numbers.- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Stéphane GALLAND
- See Also:
- Serialized Form
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgeom
-
-
Constructor Summary
Constructors Constructor Description Point2i()Construct a zero point.Point2i(double[] tuple)Constructor by copy.Point2i(double x, double y)Construct a point with the given coordinates.Point2i(float x, float y)Construct a point with the given coordinates.Point2i(int[] tuple)Constructor by copy.Point2i(int x, int y)Construct a point with the given coordinates.Point2i(long x, long y)Construct a point with the given coordinates.Point2i(Tuple2D<?> tuple)Constructor by copy.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Point2D<?,?> point, Vector2D<?,?> vector)Sets the value of this tuple to the sum of tuples t1 and t2.voidadd(Vector2D<?,?> vector)Sets the value of this tuple to the sum of itself and t1.voidadd(Vector2D<?,?> vector, Point2D<?,?> point)Sets the value of this tuple to the sum of tuples t1 and t2.static Point2iconvert(Tuple2D<?> tuple)Convert the given tuple to a real Point2i.doublegetDistance(Point2D<?,?> point)Computes the distance between this point and point p1.doublegetDistanceL1(Point2D<?,?> point)Computes the L-1 (Manhattan) distance between this point and point p1.doublegetDistanceLinf(Point2D<?,?> point)Computes the L-infinite distance between this point and point p1.doublegetDistanceSquared(Point2D<?,?> point)Computes the square of the distance between this point and point p1.GeomFactory2igetGeomFactory()Replies the geometry factory associated to this point.intgetIdistanceL1(Point2D<?,?> point)Computes the L-1 (Manhattan) distance between this point and point p1.intgetIdistanceLinf(Point2D<?,?> point)Computes the L-infinite distance between this point and point p1.voidscaleAdd(double scale, Point2D<?,?> point, Vector2D<?,?> vector)Sets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*point + vector).voidscaleAdd(double scale, Vector2D<?,?> vector)Sets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + vector).voidscaleAdd(double scale, Vector2D<?,?> vector, Point2D<?,?> point)Sets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*vector + point).voidscaleAdd(int scale, Point2D<?,?> point, Vector2D<?,?> vector)Sets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*point + vector).voidscaleAdd(int scale, Vector2D<?,?> vector)Sets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + vector).voidscaleAdd(int scale, Vector2D<?,?> vector, Point2D<?,?> point)Sets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*vector + point).voidsub(Point2D<?,?> point, Vector2D<?,?> vector)Sets the value of this tuple to the difference of tuples point and vector (this = point - vector).voidsub(Vector2D<?,?> vector)Sets the value of this tuple to the difference of itself and the given vector (this = this - vector).UnmodifiablePoint2D<Point2i,Vector2i>toUnmodifiable()Replies an unmodifiable copy of this point.-
Methods inherited from class org.arakhne.afc.math.geometry.d2.i.Tuple2i
absolute, absolute, add, add, addX, addX, addY, addY, clone, equals, getX, getY, hashCode, ix, iy, negate, negate, scale, scale, scale, scale, set, set, set, set, set, setX, setX, setY, setY, sub, sub, subX, subX, subY, subY, toJson, toString
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.arakhne.afc.vmutil.json.JsonableObject
toJson
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.Point2D
$amp$amp, $minus, $minus, $minus, $plus, $plus, operator_add, operator_and, operator_elvis, operator_equals, operator_minus, operator_minus, operator_minus, operator_notEquals, operator_plus, operator_plus, operator_remove, operator_upTo, operator_upTo, turn, turn, turn, turnLeft, turnLeft, turnLeft, turnRight, turnRight, turnRight
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.Tuple2D
absolute, absolute, add, add, addX, addX, addY, addY, clamp, clamp, clamp, clamp, clampMax, clampMax, clampMax, clampMax, clampMin, clampMin, clampMin, clampMin, clone, epsilonEquals, equals, equals, get, get, get, getX, getY, hashCode, interpolate, interpolate, ix, iy, negate, negate, scale, scale, scale, scale, set, set, set, set, set, setX, setX, setY, setY, sub, sub, subX, subX, subY, subY
-
-
-
-
Constructor Detail
-
Point2i
public Point2i()
Construct a zero point.
-
Point2i
public Point2i(Tuple2D<?> tuple)
Constructor by copy.- Parameters:
tuple- is the tuple to copy.
-
Point2i
public Point2i(int[] tuple)
Constructor by copy.- Parameters:
tuple- is the tuple to copy.
-
Point2i
public Point2i(double[] tuple)
Constructor by copy.- Parameters:
tuple- is the tuple to copy.
-
Point2i
public Point2i(int x, int y)Construct a point with the given coordinates.- Parameters:
x- x coordinate.y- y coordinate.
-
Point2i
public Point2i(float x, float y)Construct a point with the given coordinates.- Parameters:
x- x coordinate.y- y coordinate.
-
Point2i
public Point2i(double x, double y)Construct a point with the given coordinates.- Parameters:
x- x coordinate.y- y coordinate.
-
Point2i
public Point2i(long x, long y)Construct a point with the given coordinates.- Parameters:
x- x coordinate.y- y coordinate.
-
-
Method Detail
-
convert
public static Point2i convert(Tuple2D<?> tuple)
Convert the given tuple to a real Point2i.If the given tuple is already a Point2i, it is replied.
- Parameters:
tuple- the tuple.- Returns:
- the Point2i.
- Since:
- 14.0
-
getDistanceSquared
@Pure public double getDistanceSquared(Point2D<?,?> point)
Description copied from interface:Point2DComputes the square of the distance between this point and point p1.- Specified by:
getDistanceSquaredin interfacePoint2D<Point2i,Vector2i>- Parameters:
point- the other point- Returns:
- the distance.
-
getDistance
@Pure public double getDistance(Point2D<?,?> point)
Description copied from interface:Point2DComputes the distance between this point and point p1.- Specified by:
getDistancein interfacePoint2D<Point2i,Vector2i>- Parameters:
point- the other point- Returns:
- the distance.
-
getDistanceL1
@Pure public double getDistanceL1(Point2D<?,?> point)
Description copied from interface:Point2DComputes the L-1 (Manhattan) distance between this point and point p1. The L-1 distance is equal to abs(x1-x2) + abs(y1-y2).- Specified by:
getDistanceL1in interfacePoint2D<Point2i,Vector2i>- Parameters:
point- the other point- Returns:
- the distance.
-
getDistanceLinf
@Pure public double getDistanceLinf(Point2D<?,?> point)
Description copied from interface:Point2DComputes the L-infinite distance between this point and point p1. The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2)].- Specified by:
getDistanceLinfin interfacePoint2D<Point2i,Vector2i>- Parameters:
point- the other point- Returns:
- the distance.
-
getIdistanceL1
@Pure public int getIdistanceL1(Point2D<?,?> point)
Description copied from interface:Point2DComputes the L-1 (Manhattan) distance between this point and point p1. The L-1 distance is equal to abs(x1-x2) + abs(y1-y2).- Specified by:
getIdistanceL1in interfacePoint2D<Point2i,Vector2i>- Parameters:
point- the other point- Returns:
- the distance.
-
getIdistanceLinf
@Pure public int getIdistanceLinf(Point2D<?,?> point)
Description copied from interface:Point2DComputes the L-infinite distance between this point and point p1. The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2)].- Specified by:
getIdistanceLinfin interfacePoint2D<Point2i,Vector2i>- Parameters:
point- the other point- Returns:
- the distance.
-
add
public void add(Point2D<?,?> point, Vector2D<?,?> vector)
Description copied from interface:Point2DSets the value of this tuple to the sum of tuples t1 and t2.
-
add
public void add(Vector2D<?,?> vector, Point2D<?,?> point)
Description copied from interface:Point2DSets the value of this tuple to the sum of tuples t1 and t2.
-
add
public void add(Vector2D<?,?> vector)
Description copied from interface:Point2DSets the value of this tuple to the sum of itself and t1.
-
scaleAdd
public void scaleAdd(int scale, Vector2D<?,?> vector, Point2D<?,?> point)Description copied from interface:Point2DSets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*vector + point).
-
scaleAdd
public void scaleAdd(double scale, Vector2D<?,?> vector, Point2D<?,?> point)Description copied from interface:Point2DSets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*vector + point).
-
scaleAdd
public void scaleAdd(int scale, Point2D<?,?> point, Vector2D<?,?> vector)Description copied from interface:Point2DSets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*point + vector).
-
scaleAdd
public void scaleAdd(double scale, Point2D<?,?> point, Vector2D<?,?> vector)Description copied from interface:Point2DSets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*point + vector).
-
scaleAdd
public void scaleAdd(int scale, Vector2D<?,?> vector)Description copied from interface:Point2DSets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + vector).
-
scaleAdd
public void scaleAdd(double scale, Vector2D<?,?> vector)Description copied from interface:Point2DSets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + vector).
-
sub
public void sub(Point2D<?,?> point, Vector2D<?,?> vector)
Description copied from interface:Point2DSets the value of this tuple to the difference of tuples point and vector (this = point - vector).
-
sub
public void sub(Vector2D<?,?> vector)
Description copied from interface:Point2DSets the value of this tuple to the difference of itself and the given vector (this = this - vector).
-
getGeomFactory
public GeomFactory2i getGeomFactory()
Description copied from interface:Point2DReplies the geometry factory associated to this point.- Specified by:
getGeomFactoryin interfacePoint2D<Point2i,Vector2i>- Returns:
- the factory.
-
toUnmodifiable
@Pure public UnmodifiablePoint2D<Point2i,Vector2i> toUnmodifiable()
Description copied from interface:Point2DReplies an unmodifiable copy of this point.- Specified by:
toUnmodifiablein interfacePoint2D<Point2i,Vector2i>- Returns:
- an unmodifiable copy.
-
-