- java.lang.Object
-
- org.arakhne.afc.math.geometry.d2.d.Tuple2d<Point2d>
-
- org.arakhne.afc.math.geometry.d2.d.Point2d
-
- All Implemented Interfaces:
Serializable,Cloneable,Point2D<Point2d,Vector2d>,Tuple2D<Point2d>,JsonableObject
- Direct Known Subclasses:
OrientedPoint2d
public class Point2d extends Tuple2d<Point2d> implements Point2D<Point2d,Vector2d>
2D Point with 2 double precision floating-point 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 Point2d()Construct a zero point.Point2d(double[] tuple)Constructor.Point2d(double x, double y)Construct a point with the given coordinates.Point2d(float x, float y)Construct a point with the given coordinates.Point2d(int[] tuple)Constructor.Point2d(int x, int y)Construct a point with the given coordinates.Point2d(long x, long y)Construct a point with the given coordinates.Point2d(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 Point2dconvert(Tuple2D<?> tuple)Convert the given tuple to a real Point2d.doublegetDistance(Point2D<?,?> pt)Computes the distance between this point and point p1.doublegetDistanceL1(Point2D<?,?> pt)Computes the L-1 (Manhattan) distance between this point and point p1.doublegetDistanceLinf(Point2D<?,?> pt)Computes the L-infinite distance between this point and point p1.doublegetDistanceSquared(Point2D<?,?> pt)Computes the square of the distance between this point and point p1.GeomFactory2dgetGeomFactory()Replies the geometry factory associated to this point.intgetIdistanceL1(Point2D<?,?> pt)Computes the L-1 (Manhattan) distance between this point and point p1.intgetIdistanceLinf(Point2D<?,?> pt)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<Point2d,Vector2d>toUnmodifiable()Replies an unmodifiable copy of this point.-
Methods inherited from class org.arakhne.afc.math.geometry.d2.d.Tuple2d
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
-
Point2d
public Point2d()
Construct a zero point.
-
Point2d
public Point2d(Tuple2D<?> tuple)
Constructor by copy.- Parameters:
tuple- is the tuple to copy.
-
Point2d
public Point2d(int[] tuple)
Constructor.- Parameters:
tuple- is the tuple to copy.
-
Point2d
public Point2d(double[] tuple)
Constructor.- Parameters:
tuple- is the tuple to copy.
-
Point2d
public Point2d(int x, int y)Construct a point with the given coordinates.- Parameters:
x- x coordinate.y- y coordinate.
-
Point2d
public Point2d(float x, float y)Construct a point with the given coordinates.- Parameters:
x- x coordinate.y- y coordinate.
-
Point2d
public Point2d(double x, double y)Construct a point with the given coordinates.- Parameters:
x- x coordinate.y- y coordinate.
-
Point2d
public Point2d(long x, long y)Construct a point with the given coordinates.- Parameters:
x- x coordinate.y- y coordinate.
-
-
Method Detail
-
convert
public static Point2d convert(Tuple2D<?> tuple)
Convert the given tuple to a real Point2d.If the given tuple is already a Point2d, it is replied.
- Parameters:
tuple- the tuple.- Returns:
- the Point2d.
- Since:
- 14.0
-
getGeomFactory
public GeomFactory2d getGeomFactory()
Description copied from interface:Point2DReplies the geometry factory associated to this point.- Specified by:
getGeomFactoryin interfacePoint2D<Point2d,Vector2d>- Returns:
- the factory.
-
getDistanceSquared
@Pure public double getDistanceSquared(Point2D<?,?> pt)
Description copied from interface:Point2DComputes the square of the distance between this point and point p1.- Specified by:
getDistanceSquaredin interfacePoint2D<Point2d,Vector2d>- Parameters:
pt- the other point- Returns:
- the distance.
-
getDistance
@Pure public double getDistance(Point2D<?,?> pt)
Description copied from interface:Point2DComputes the distance between this point and point p1.- Specified by:
getDistancein interfacePoint2D<Point2d,Vector2d>- Parameters:
pt- the other point- Returns:
- the distance.
-
getDistanceL1
@Pure public double getDistanceL1(Point2D<?,?> pt)
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<Point2d,Vector2d>- Parameters:
pt- the other point- Returns:
- the distance.
-
getDistanceLinf
@Pure public double getDistanceLinf(Point2D<?,?> pt)
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<Point2d,Vector2d>- Parameters:
pt- the other point- Returns:
- the distance.
-
getIdistanceL1
@Pure public int getIdistanceL1(Point2D<?,?> pt)
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<Point2d,Vector2d>- Parameters:
pt- the other point- Returns:
- the distance.
-
getIdistanceLinf
@Pure public int getIdistanceLinf(Point2D<?,?> pt)
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<Point2d,Vector2d>- Parameters:
pt- 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).
-
toUnmodifiable
@Pure public UnmodifiablePoint2D<Point2d,Vector2d> toUnmodifiable()
Description copied from interface:Point2DReplies an unmodifiable copy of this point.- Specified by:
toUnmodifiablein interfacePoint2D<Point2d,Vector2d>- Returns:
- an unmodifiable copy.
-
-