- java.lang.Object
-
- org.arakhne.afc.math.geometry.d2.i.Tuple2i<Vector2i>
-
- org.arakhne.afc.math.geometry.d2.i.Vector2i
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Tuple2D<Vector2i>
,Vector2D<Vector2i,Point2i>
,JsonableObject
public class Vector2i extends Tuple2i<Vector2i> implements Vector2D<Vector2i,Point2i>
2D Vector 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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.arakhne.afc.math.geometry.d2.Vector2D
Vector2D.PowerResult<T extends Vector2D<? super T,?>>
-
-
Constructor Summary
Constructors Constructor Description Vector2i()
Construct a zero vector.Vector2i(double[] tuple)
Constructor by copy.Vector2i(double x, double y)
Constructor a vector with the given coordinates.Vector2i(float x, float y)
Constructor a vector with the given coordinates.Vector2i(int[] tuple)
Constructor by copy.Vector2i(int x, int y)
Constructor a vector with the given coordinates.Vector2i(long x, long y)
Constructor a vector with the given coordinates.Vector2i(Tuple2D<?> tuple)
Constructor by copy.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Vector2D<?,?> vector)
Sets the value of this tuple to the sum of itself and the given vector.void
add(Vector2D<?,?> vector1, Vector2D<?,?> vector2)
Sets the value of this tuple to the sum of tuples vector1 and vector2.static Vector2i
convert(Tuple2D<?> tuple)
Convert the given tuple to a real Vector2i.double
dot(Vector2D<?,?> vector)
Computes the dot product of the this vector and the given vector.GeomFactory2i
getGeomFactory()
Replies the geometry factory associated to this point.double
getLength()
Returns the length of this vector.double
getLengthSquared()
Returns the squared length of this vector.double
perp(Vector2D<?,?> vector)
Compute the the perpendicular product of the two vectors (aka. the determinant of two vectors).void
scaleAdd(double scale, Vector2D<?,?> vector)
Sets the value of this tuple to the scalar multiplication of itself and then adds tuple vector (this = s*this + vector).void
scaleAdd(double scale, Vector2D<?,?> vector1, Vector2D<?,?> vector2)
Sets the value of this tuple to the scalar multiplication of the tuple vector1 plus the tuple vector2 (this = s*vector1 + vector2).void
scaleAdd(int scale, Vector2D<?,?> vector)
Sets the value of this tuple to the scalar multiplication of itself and then adds tuple vector (this = s*this + vector).void
scaleAdd(int scale, Vector2D<?,?> vector1, Vector2D<?,?> vector2)
Sets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*t1 + t2).void
setLength(double newLength)
Change the length of the vector.void
sub(Point2D<?,?> point1, Point2D<?,?> point2)
Sets the value of this tuple to the difference of tuples point1 and point2 (this = point1 - point2).void
sub(Vector2D<?,?> vector)
Sets the value of this tuple to the difference of itself and vector (this = this - vector).void
sub(Vector2D<?,?> vector1, Vector2D<?,?> vector2)
Sets the value of this tuple to the difference of tuples vector1 and vector2 (this = vector1 - vector2).static Vector2i
toOrientationVector(double angle)
Replies the orientation vector, which is corresponding to the given angle on a trigonometric circle.UnmodifiableVector2D<Vector2i,Point2i>
toUnmodifiable()
Replies an unmodifiable copy of this vector.-
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.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
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.Vector2D
$div, $minus, $minus, $minus, $minus, $plus, $plus, $plus, $times, $times, $up, $up, angle, getOrientationAngle, isOrthogonal, isUnitVector, makeOrthogonal, normalize, normalize, operator_add, operator_divide, operator_doubleDotLessThan, operator_elvis, operator_equals, operator_greaterThanDoubleDot, operator_minus, operator_minus, operator_minus, operator_minus, operator_multiply, operator_multiply, operator_notEquals, operator_plus, operator_plus, operator_plus, operator_power, operator_power, operator_remove, operator_upTo, power, signedAngle, toColinearVector, toOrthogonalVector, toUnitVector, turn, turn, turnLeft, turnLeft, turnLeft, turnRight, turnRight
-
-
-
-
Constructor Detail
-
Vector2i
public Vector2i()
Construct a zero vector.
-
Vector2i
public Vector2i(Tuple2D<?> tuple)
Constructor by copy.- Parameters:
tuple
- is the tuple to copy.
-
Vector2i
public Vector2i(int[] tuple)
Constructor by copy.- Parameters:
tuple
- is the tuple to copy.
-
Vector2i
public Vector2i(double[] tuple)
Constructor by copy.- Parameters:
tuple
- is the tuple to copy.
-
Vector2i
public Vector2i(int x, int y)
Constructor a vector with the given coordinates.- Parameters:
x
- x coordinate.y
- y coordinate.
-
Vector2i
public Vector2i(float x, float y)
Constructor a vector with the given coordinates.- Parameters:
x
- x coordinate.y
- y coordinate.
-
Vector2i
public Vector2i(double x, double y)
Constructor a vector with the given coordinates.- Parameters:
x
- x coordinate.y
- y coordinate.
-
Vector2i
public Vector2i(long x, long y)
Constructor a vector with the given coordinates.- Parameters:
x
- x coordinate.y
- y coordinate.
-
-
Method Detail
-
convert
public static Vector2i convert(Tuple2D<?> tuple)
Convert the given tuple to a real Vector2i.If the given tuple is already a Vector2i, it is replied.
- Parameters:
tuple
- the tuple.- Returns:
- the Vector2i.
- Since:
- 14.0
-
toOrientationVector
@Pure public static Vector2i toOrientationVector(double angle)
Replies the orientation vector, which is corresponding to the given angle on a trigonometric circle.- Parameters:
angle
- is the angle in radians to translate.- Returns:
- the orientation vector which is corresponding to the given angle.
-
dot
@Pure public double dot(Vector2D<?,?> vector)
Description copied from interface:Vector2D
Computes the dot product of the this vector and the given vector.
-
perp
@Pure public double perp(Vector2D<?,?> vector)
Description copied from interface:Vector2D
Compute the the perpendicular product of the two vectors (aka. the determinant of two vectors).
wheredet(X1, X2) = |X1|.|X2|.sin(a)
X1
andX2
are two vectors anda
is the angle betweenX1
andX2
.
-
getLength
@Pure public double getLength()
Description copied from interface:Vector2D
Returns the length of this vector.
-
getLengthSquared
@Pure public double getLengthSquared()
Description copied from interface:Vector2D
Returns the squared length of this vector.- Specified by:
getLengthSquared
in interfaceVector2D<Vector2i,Point2i>
- Returns:
- the squared length of this vector
-
add
public void add(Vector2D<?,?> vector1, Vector2D<?,?> vector2)
Description copied from interface:Vector2D
Sets the value of this tuple to the sum of tuples vector1 and vector2.
-
add
public void add(Vector2D<?,?> vector)
Description copied from interface:Vector2D
Sets the value of this tuple to the sum of itself and the given vector.
-
scaleAdd
public void scaleAdd(int scale, Vector2D<?,?> vector1, Vector2D<?,?> vector2)
Description copied from interface:Vector2D
Sets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*t1 + t2).
-
scaleAdd
public void scaleAdd(double scale, Vector2D<?,?> vector1, Vector2D<?,?> vector2)
Description copied from interface:Vector2D
Sets the value of this tuple to the scalar multiplication of the tuple vector1 plus the tuple vector2 (this = s*vector1 + vector2).
-
scaleAdd
public void scaleAdd(int scale, Vector2D<?,?> vector)
Description copied from interface:Vector2D
Sets the value of this tuple to the scalar multiplication of itself and then adds tuple vector (this = s*this + vector).
-
scaleAdd
public void scaleAdd(double scale, Vector2D<?,?> vector)
Description copied from interface:Vector2D
Sets the value of this tuple to the scalar multiplication of itself and then adds tuple vector (this = s*this + vector).
-
sub
public void sub(Vector2D<?,?> vector1, Vector2D<?,?> vector2)
Description copied from interface:Vector2D
Sets the value of this tuple to the difference of tuples vector1 and vector2 (this = vector1 - vector2).
-
sub
public void sub(Point2D<?,?> point1, Point2D<?,?> point2)
Description copied from interface:Vector2D
Sets the value of this tuple to the difference of tuples point1 and point2 (this = point1 - point2).
-
sub
public void sub(Vector2D<?,?> vector)
Description copied from interface:Vector2D
Sets the value of this tuple to the difference of itself and vector (this = this - vector).
-
setLength
public void setLength(double newLength)
Description copied from interface:Vector2D
Change the length of the vector. The direction of the vector is unchanged.
-
getGeomFactory
public GeomFactory2i getGeomFactory()
Description copied from interface:Vector2D
Replies the geometry factory associated to this point.- Specified by:
getGeomFactory
in interfaceVector2D<Vector2i,Point2i>
- Returns:
- the factory.
-
toUnmodifiable
@Pure public UnmodifiableVector2D<Vector2i,Point2i> toUnmodifiable()
Description copied from interface:Vector2D
Replies an unmodifiable copy of this vector.- Specified by:
toUnmodifiable
in interfaceVector2D<Vector2i,Point2i>
- Returns:
- an unmodifiable copy.
-
-