Interface Vector2D<RV extends Vector2D<? super RV,? super RP>,RP extends Point2D<? super RP,? super RV>>
-
- Type Parameters:
RV
- is the type of vector that can be returned by this tuple.RP
- is the type of point that can be returned by this tuple.
- All Superinterfaces:
Cloneable
,JsonableObject
,Serializable
,Tuple2D<RV>
- All Known Subinterfaces:
UnmodifiableVector2D<RV,RP>
- All Known Implementing Classes:
ImmutableVector2D
,InnerComputationVector2afp
,InnerComputationVector2ai
,Vector2d
,Vector2dfx
,Vector2i
,Vector2ifx
public interface Vector2D<RV extends Vector2D<? super RV,? super RP>,RP extends Point2D<? super RP,? super RV>> extends Tuple2D<RV>
2D Vector.- Since:
- 13.0
- Version:
- 17.0 2020-01-04 14:41:43
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.core
- Maven Artifact Id:
- mathgeom
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Vector2D.PowerResult<T extends Vector2D<? super T,?>>
Result of the power of a Vector2D.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default RV
$div(double factor)
Scale this vector:this / factor
.default RV
$minus()
Negation of this vector:-this
.default RV
$minus(double scalar)
Subtract a vector to this scalar:this - scalar
.default RP
$minus(Point2D<?,?> point)
Subtract a vector to this point:this - point
.default RV
$minus(Vector2D<?,?> v)
Subtract a vector to this vector:this - v
.default RV
$plus(double scalar)
Sum of this vector and the given scalar:this + scalar
.default RP
$plus(Point2D<?,?> pt)
Add this vector to a point:this + p
.default RV
$plus(Vector2D<?,?> v)
Sum of this vector and the given vector:this + v
.default RV
$times(double factor)
Scale this vector:this * factor
.default double
$times(Vector2D<?,?> v)
Dot product:this * v
.default Vector2D.PowerResult<RV>
$up(int power)
Compute the power of this vector:this ^ n
.default double
$up(Vector2D<?,?> v)
Perp product of this vector and the given vector:this ^ v
.default void
add(Vector2D<?,?> vector)
Sets the value of this tuple to the sum of itself and the given vector.default void
add(Vector2D<?,?> vector1, Vector2D<?,?> vector2)
Sets the value of this tuple to the sum of tuples vector1 and vector2.default double
angle(Vector2D<?,?> vector)
Returns the angle in radians between this vector and the vector parameter; the return value is constrained to the range [0, PI].static double
angleOfVector(double x, double y)
Return the trigonometric angle of a vector.static double
angleOfVector(double x1, double y1, double x2, double y2)
Return the trigonometric angle of a vector.default double
dot(Vector2D<?,?> vector)
Computes the dot product of the this vector and the given vector.static double
dotProduct(double x1, double y1, double x2, double y2)
Compute the dot product of two vectors.GeomFactory2D<RV,RP>
getGeomFactory()
Replies the geometry factory associated to this point.default double
getLength()
Returns the length of this vector.default double
getLengthSquared()
Returns the squared length of this vector.default double
getOrientationAngle()
Replies the orientation angle on a trigonometric circle that is corresponding to the given direction of this vector.static boolean
isCCW(double x1, double y1, double x2, double y2)
Replies if the vectors are defined in a counter-clockwise order.static boolean
isCollinearVectors(double x1, double y1, double x2, double y2)
Replies if two vectors are colinear.static boolean
isOrthogonal(double x1, double y1, double x2, double y2)
Replies if the vectors are orthogonal vectors.static boolean
isOrthogonal(double x1, double y1, double x2, double y2, double epsilon)
Replies if the vectors are orthogonal vectors.default boolean
isOrthogonal(Vector2D<?,?> vector)
Replies if this vector is orthogonal to the given vector.default boolean
isUnitVector()
Replies if this vector is a unit vector.static boolean
isUnitVector(double x, double y)
Replies if the vector is a unit vector.static boolean
isUnitVector(double x, double y, double epsilon)
Replies if the vector is a unit vector.default void
makeOrthogonal()
Change the coordinates of this vector to make it an orthogonal vector to the original coordinates.default void
normalize()
Normalizes this vector in place.default void
normalize(Vector2D<?,?> vector)
Sets the value of this vector to the normalization of vector vector.default void
operator_add(Vector2D<?,?> v)
Add a vector to this vector:this += v
.default RV
operator_divide(double factor)
Scale this vector:this / factor
.default double
operator_doubleDotLessThan(Vector2D<?,?> v)
Replies the signed angle from v to this:this ..< v
.default Vector2D<? extends RV,? extends RP>
operator_elvis(Vector2D<? extends RV,? extends RP> v)
If this vector is epsilon equal to zero then reply v else reply this:this ?: v
.default boolean
operator_equals(Tuple2D<?> v)
Replies if this vector and the given vector are equal:this == v
.default double
operator_greaterThanDoubleDot(Vector2D<?,?> v)
Replies the signed angle from this to v:this >.. v
.default RV
operator_minus()
Negation of this vector:-this
.default RV
operator_minus(double scalar)
Subtract a vector to this scalar:this - scalar
.default RP
operator_minus(Point2D<?,?> point)
Subtract a vector to this point:this - point
.default RV
operator_minus(Vector2D<?,?> v)
Subtract a vector to this vector:this - v
.default RV
operator_multiply(double factor)
Scale this vector:this * factor
.default double
operator_multiply(Vector2D<?,?> v)
Dot product:this * v
.default boolean
operator_notEquals(Tuple2D<?> v)
Replies if this vector and the given vector are different:this != v
.default RV
operator_plus(double scalar)
Sum of this vector and the given scalar:this + scalar
.default RP
operator_plus(Point2D<?,?> pt)
Add this vector to a point:this + p
.default RV
operator_plus(Vector2D<?,?> v)
Sum of this vector and the given vector:this + v
.default Vector2D.PowerResult<RV>
operator_power(int power)
Compute the power of this vector:this ** n
.default double
operator_power(Vector2D<?,?> v)
Perp product of this vector and the given vector:this ** v
.default void
operator_remove(Vector2D<?,?> v)
Substract a vector to this vector:this -= v
.default double
operator_upTo(Vector2D<?,?> v)
Replies if the absolute angle between this and v:this .. b
.default double
perp(Vector2D<?,?> vector)
Compute the the perpendicular product of the two vectors (aka. the determinant of two vectors).static double
perpProduct(double x1, double y1, double x2, double y2)
Compute the the perpendicular product of the two vectors (aka. the determinant of two vectors).default Vector2D.PowerResult<RV>
power(int power)
Compute the power of this vector.default 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).default 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).default 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).default void
scaleAdd(int scale, Vector2D<?,?> t1, Vector2D<?,?> t2)
Sets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*t1 + t2).default void
setLength(double newLength)
Change the length of the vector.static double
signedAngle(double x1, double y1, double x2, double y2)
Compute the signed angle between two vectors.default double
signedAngle(Vector2D<?,?> vector)
Compute a signed angle between this vector and the given vector.default void
sub(Point2D<?,?> point1, Point2D<?,?> point2)
Sets the value of this tuple to the difference of tuples point1 and point2 (this = point1 - point2).default void
sub(Vector2D<?,?> vector)
Sets the value of this tuple to the difference of itself and vector (this = this - vector).default void
sub(Vector2D<?,?> vector1, Vector2D<?,?> vector2)
Sets the value of this tuple to the difference of tuples vector1 and vector2 (this = vector1 - vector2).default RV
toColinearVector(double length)
Replies a vector of the given length that is colinear to this vector.default RV
toOrthogonalVector()
Replies the orthogonal vector to this vector.default RV
toUnitVector()
Replies the unit vector of this vector.UnmodifiableVector2D<RV,RP>
toUnmodifiable()
Replies an unmodifiable copy of this vector.default void
turn(double angle)
Turn this vector about the given rotation angle.default void
turn(double angle, Vector2D<?,?> vectorToTurn)
Turn the given vector about the given rotation angle, and set this vector with the result.default void
turnLeft(double angle)
Turn this vector on the left when the given rotation angle is positive.default void
turnLeft(double angle, Vector2D<?,?> vectorToTurn)
Turn the given vector on the left, and set this vector with the result.default void
turnLeft(double angle, Vector2D<?,?> vectorToTurn, CoordinateSystem2D system)
Turn the given vector on the left, and set this vector with the result.default void
turnRight(double angle)
Turn this vector on the right when the given rotation angle is positive.default void
turnRight(double angle, Vector2D<?,?> vectorToTurn)
Turn this vector on the right when the given rotation angle is positive.-
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
-
-
-
-
Method Detail
-
isUnitVector
@Pure static boolean isUnitVector(double x, double y)
Replies if the vector is a unit vector.Due to the precision on floating-point computations, the test of unit-vector must consider that the norm of the given vector is approximatively equal to 1. The precision (i.e. the number of significant decimals) is given by
GeomConstants.UNIT_VECTOR_EPSILON
.- Parameters:
x
- is the X coordinate of the vector.y
- is the Y coordinate of the vector.- Returns:
true
if the two given vectors are colinear.- Since:
- 13.0
- See Also:
MathUtil.isEpsilonEqual(double, double, double)
,GeomConstants.UNIT_VECTOR_EPSILON
,isUnitVector(double, double, double)
-
isUnitVector
@Pure static boolean isUnitVector(double x, double y, double epsilon)
Replies if the vector is a unit vector.Due to the precision on floating-point computations, the test of unit-vector must consider that the norm of the given vector is approximatively equal to 1. The precision (i.e. the number of significant decimals) is given by
epsilon
.- Parameters:
x
- is the X coordinate of the vector.y
- is the Y coordinate of the vector.epsilon
- the precision distance to assumed for equality.- Returns:
true
if the two given vectors are colinear.- Since:
- 13.0
- See Also:
MathUtil.isEpsilonEqual(double, double, double)
,isUnitVector(double, double)
-
isUnitVector
@Pure default boolean isUnitVector()
Replies if this vector is a unit vector. A unit vector has a length equal to 1.- Returns:
true
if the vector has a length equal to 1.false
otherwise.
-
isOrthogonal
@Pure static boolean isOrthogonal(double x1, double y1, double x2, double y2)
Replies if the vectors are orthogonal vectors.Due to the precision on floating-point computations, the test of orthogonality is approximated. The default epsilon is
GeomConstants.ORTHOGONAL_VECTOR_EPSILON
.- Parameters:
x1
- is the X coordinate of the first unit vector.y1
- is the Y coordinate of the first unit vector.x2
- is the X coordinate of the second unit vector.y2
- is the Y coordinate of the second unit vector.- Returns:
true
if the two given vectors are colinear.- Since:
- 13.0
- See Also:
MathUtil.isEpsilonEqual(double, double, double)
,GeomConstants.ORTHOGONAL_VECTOR_EPSILON
,isUnitVector(double, double, double)
-
isOrthogonal
@Pure static boolean isOrthogonal(double x1, double y1, double x2, double y2, double epsilon)
Replies if the vectors are orthogonal vectors.- Parameters:
x1
- is the X coordinate of the first unit vector.y1
- is the Y coordinate of the first unit vector.x2
- is the X coordinate of the second unit vector.y2
- is the Y coordinate of the second unit vector.epsilon
- the precision distance to assumed for equality.- Returns:
true
if the two given vectors are orthogonal.- Since:
- 13.0
- See Also:
isOrthogonal(double, double, double, double)
-
isOrthogonal
@Pure default boolean isOrthogonal(Vector2D<?,?> vector)
Replies if this vector is orthogonal to the given vector.- Parameters:
vector
- the vector to compare to this vector.- Returns:
true
if the vectors are orthogonal.false
otherwise.
-
isCollinearVectors
@Pure static boolean isCollinearVectors(double x1, double y1, double x2, double y2)
Replies if two vectors are colinear.This function uses the equal-to-zero test with the error
Math.ulp(double)
.- Parameters:
x1
- is the X coordinate of the first vectory1
- is the Y coordinate of the first vectorx2
- is the X coordinate of the second vectory2
- is the Y coordinate of the second vector- Returns:
true
if the two given vectors are colinear.- Since:
- 13.0
- See Also:
MathUtil.isEpsilonZero(double)
-
perpProduct
@Pure static double perpProduct(double x1, double y1, double x2, double y2)
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
.Let consider that dotProduct projects the point (px,py) on the Ox axis, and perpProduct projects the point (py,py) on the Oy axis. Then:
You could note that the semantics of the parameters differ:perpProduct(ax, ay, px, py) = dotProduct(px, py, -ay, ax)
perpProduct(axisX, axisY, pointX, pointY)
dotProduct(pointX, pointY, axisX, axisY)
- Parameters:
x1
- x coordinate of the first vector.y1
- y coordinate of the first vector.x2
- x coordinate of the second vector.y2
- y coordinate of the second vector.- Returns:
- the determinant
-
dotProduct
@Pure static double dotProduct(double x1, double y1, double x2, double y2)
Compute the dot product of two vectors.Let consider that dotProduct projects the point (px,py) on the Ox axis, and perpProduct projects the point (py,py) on the Oy axis. Then:
You could note that the semantics of the parameters differ:perpProduct(ax, ay, px, py) = dotProduct(px, py, -ay, ax)
perpProduct(axisX, axisY, pointX, pointY)
dotProduct(pointX, pointY, axisX, axisY)
- Parameters:
x1
- x coordinate of the first vector.y1
- y coordinate of the first vector.x2
- x coordinate of the second vector.y2
- y coordinate of the second vector.- Returns:
- the dot product.
-
isCCW
@Pure static boolean isCCW(double x1, double y1, double x2, double y2)
Replies if the vectors are defined in a counter-clockwise order.The two vectors are defined in a counter-clockwise order if the sinus from the first vector to the second vector is positive.
In other words, let the angle between the two vectors that is replied by
signedAngle(double, double, double, double)
. The vectors are defined in an counter-clockwise order if the angle is positive.- Parameters:
x1
- the first coordinate of the first vector.y1
- the second coordinate of the first vector.x2
- the first coordinate of the second vector.y2
- the second coordinate of the second vector.- Returns:
true
if the vectors are defined in a counter-clockwise order.- See Also:
signedAngle(double, double, double, double)
,perpProduct(double, double, double, double)
-
signedAngle
@Pure static double signedAngle(double x1, double y1, double x2, double y2)
Compute the signed angle between two vectors.- Parameters:
x1
- the first coordinate of the first vector.y1
- the second coordinate of the first vector.x2
- the first coordinate of the second vector.y2
- the second coordinate of the second vector.- Returns:
- the angle between
-PI
andPI
. - See Also:
isCCW(double, double, double, double)
-
signedAngle
@Pure default double signedAngle(Vector2D<?,?> vector)
Compute a signed angle between this vector and the given vector.The signed angle between this vector and the given
vector
is the rotation angle to apply to this vector to be colinear to the givenvector
and pointing the same demi-plane. It means that the angle replied by this function is be negative if the rotation to apply is clockwise, and positive if the rotation is counterclockwise.The value replied by
angle(Vector2D)
is the absolute value of the vlaue replied by this function.- Parameters:
vector
- is the vector to reach.- Returns:
- the rotation angle to turn this vector to reach
v
.
-
angleOfVector
@Pure static double angleOfVector(double x1, double y1, double x2, double y2)
Return the trigonometric angle of a vector. The vector is from the first point to the second point.The trigonometric angle is the signed angle between the vectors (1;0) and (x2-x1;y2-y1).
- Parameters:
x1
- is the coordinate of the vector origin point.y1
- is the coordinate of the vector origin point.x2
- is the coordinate of the vector target point.y2
- is the coordinate of the vector target point.- Returns:
- the trigonometric angle in radians in [-PI;PI].
-
angleOfVector
@Pure static double angleOfVector(double x, double y)
Return the trigonometric angle of a vector. The vector is from the first point to the second point.The trigonometric angle is the signed angle between the vectors (1;0) and (x;y).
- Parameters:
x
- is the coordinate of the vector.y
- is the coordinate of the vector.- Returns:
- the trigonometric angle in radians in [-PI;PI].
-
add
default void add(Vector2D<?,?> vector1, Vector2D<?,?> vector2)
Sets the value of this tuple to the sum of tuples vector1 and vector2.- Parameters:
vector1
- the first tuplevector2
- the second tuple
-
add
default void add(Vector2D<?,?> vector)
Sets the value of this tuple to the sum of itself and the given vector.- Parameters:
vector
- the other tuple
-
scaleAdd
default void scaleAdd(int scale, Vector2D<?,?> t1, Vector2D<?,?> t2)
Sets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*t1 + t2).- Parameters:
scale
- the scalar valuet1
- the tuple to be multipledt2
- the tuple to be added
-
scaleAdd
default 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).- Parameters:
scale
- the scalar valuevector1
- the tuple to be multipledvector2
- the tuple to be added
-
scaleAdd
default 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).- Parameters:
scale
- the scalar valuevector
- the tuple to be added
-
scaleAdd
default 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).- Parameters:
scale
- the scalar valuevector
- the tuple to be added
-
sub
default void sub(Vector2D<?,?> vector1, Vector2D<?,?> vector2)
Sets the value of this tuple to the difference of tuples vector1 and vector2 (this = vector1 - vector2).- Parameters:
vector1
- the first tuplevector2
- the second tuple
-
sub
default void sub(Point2D<?,?> point1, Point2D<?,?> point2)
Sets the value of this tuple to the difference of tuples point1 and point2 (this = point1 - point2).- Parameters:
point1
- the first tuplepoint2
- the second tuple
-
sub
default void sub(Vector2D<?,?> vector)
Sets the value of this tuple to the difference of itself and vector (this = this - vector).- Parameters:
vector
- the other tuple
-
power
@Pure default Vector2D.PowerResult<RV> power(int power)
Compute the power of this vector.If the power is even, the result is a scalar. If the power is odd, the result is a vector.
- Parameters:
power
- the power factor.- Returns:
- the power of this vector.
- See Also:
- "http://www.euclideanspace.com/maths/algebra/vectors/vecAlgebra/powers/index.htm"
-
dot
@Pure default double dot(Vector2D<?,?> vector)
Computes the dot product of the this vector and the given vector.- Parameters:
vector
- the other vector- Returns:
- the dot product.
-
perp
@Pure default double perp(Vector2D<?,?> vector)
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
.- Parameters:
vector
- the vertor.- Returns:
- the determinant
-
makeOrthogonal
default void makeOrthogonal()
Change the coordinates of this vector to make it an orthogonal vector to the original coordinates.The orthogonal vector is always the one obtain after a clockwise rotation of this vector.
The orthogonal vector does not depends on the current coordinate system.
-
toOrthogonalVector
@Pure default RV toOrthogonalVector()
Replies the orthogonal vector to this vector.The orthogonal vector is always the one obtain after a clockwise rotation of this vector.
The orthogonal vector does not depends on the current coordinate system.
- Returns:
- the orthogonal vector.
-
toColinearVector
@Pure default RV toColinearVector(double length)
Replies a vector of the given length that is colinear to this vector.- Parameters:
length
- the length of the new vector.- Returns:
- the colinear vector.
-
getLength
@Pure default double getLength()
Returns the length of this vector.- Returns:
- the length of this vector
-
getLengthSquared
@Pure default double getLengthSquared()
Returns the squared length of this vector.- Returns:
- the squared length of this vector
-
normalize
default void normalize(Vector2D<?,?> vector)
Sets the value of this vector to the normalization of vector vector.- Parameters:
vector
- the un-normalized vector
-
normalize
default void normalize()
Normalizes this vector in place.If the length of the vector is zero, x and y are set to zero.
-
angle
@Pure default double angle(Vector2D<?,?> vector)
Returns the angle in radians between this vector and the vector parameter; the return value is constrained to the range [0, PI].- Parameters:
vector
- the other vector- Returns:
- the angle in radians in the range [0, PI]
-
turn
default void turn(double angle)
Turn this vector about the given rotation angle.The rotation is done according to the trigonometric coordinate. A positive rotation angle corresponds to a left or right rotation according to the current
CoordinateSystem2D
.- Parameters:
angle
- is the rotation angle in radians.- See Also:
turn(double, Vector2D)
,turnLeft(double)
,turnRight(double)
-
turn
default void turn(double angle, Vector2D<?,?> vectorToTurn)
Turn the given vector about the given rotation angle, and set this vector with the result.The rotation is done according to the trigonometric coordinate. A positive rotation angle corresponds to a left or right rotation according to the current
CoordinateSystem2D
.- Parameters:
angle
- is the rotation angle in radians.vectorToTurn
- the vector to turn.- See Also:
turn(double)
,turnLeft(double)
,turnRight(double)
-
turnLeft
default void turnLeft(double angle)
Turn this vector on the left when the given rotation angle is positive.A positive rotation angle corresponds to a left or right rotation according to the current
CoordinateSystem2D
.- Parameters:
angle
- is the rotation angle in radians.- See Also:
CoordinateSystem2D
,turnLeft(double, Vector2D)
,turn(double)
,turnRight(double)
-
turnLeft
default void turnLeft(double angle, Vector2D<?,?> vectorToTurn)
Turn the given vector on the left, and set this vector with the result.A positive rotation angle corresponds to a left or right rotation according to the current
CoordinateSystem2D
.- Parameters:
angle
- is the rotation angle in radians.vectorToTurn
- the vector to turn.- See Also:
CoordinateSystem2D
,turnLeft(double, Vector2D)
,turn(double)
,turnRight(double)
-
turnLeft
default void turnLeft(double angle, Vector2D<?,?> vectorToTurn, CoordinateSystem2D system)
Turn the given vector on the left, and set this vector with the result.A positive rotation angle corresponds to a left or right rotation according to the current
CoordinateSystem2D
.- Parameters:
angle
- is the rotation angle in radians.vectorToTurn
- the vector to turn.system
- the coordinate system.- Since:
- 14.0
- See Also:
CoordinateSystem2D
,turnLeft(double, Vector2D)
,turn(double)
,turnRight(double)
-
turnRight
default void turnRight(double angle)
Turn this vector on the right when the given rotation angle is positive.A positive rotation angle corresponds to a left or right rotation according to the current
CoordinateSystem2D
.- Parameters:
angle
- is the rotation angle in radians.- See Also:
CoordinateSystem2D
,turn(double)
,turnLeft(double)
-
turnRight
default void turnRight(double angle, Vector2D<?,?> vectorToTurn)
Turn this vector on the right when the given rotation angle is positive.A positive rotation angle corresponds to a left or right rotation according to the current
CoordinateSystem2D
.- Parameters:
angle
- is the rotation angle in radians.vectorToTurn
- the vector to turn.- See Also:
CoordinateSystem2D
,turn(double)
,turnLeft(double)
-
getOrientationAngle
@Pure default double getOrientationAngle()
Replies the orientation angle on a trigonometric circle that is corresponding to the given direction of this vector.- Returns:
- the angle on a trigonometric circle that is corresponding to the given orientation vector.
-
setLength
default void setLength(double newLength)
Change the length of the vector. The direction of the vector is unchanged.- Parameters:
newLength
- - the new length.
-
toUnitVector
@Pure default RV toUnitVector()
Replies the unit vector of this vector.- Returns:
- the unit vector of this vector.
-
toUnmodifiable
@Pure UnmodifiableVector2D<RV,RP> toUnmodifiable()
Replies an unmodifiable copy of this vector.- Returns:
- an unmodifiable copy.
-
getGeomFactory
@Pure GeomFactory2D<RV,RP> getGeomFactory()
Replies the geometry factory associated to this point.- Returns:
- the factory.
-
operator_add
default void operator_add(Vector2D<?,?> v)
Add a vector to this vector:this += v
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
- Parameters:
v
- the vector- See Also:
add(Vector2D)
-
operator_remove
default void operator_remove(Vector2D<?,?> v)
Substract a vector to this vector:this -= v
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
- Parameters:
v
- the vector- See Also:
sub(Vector2D)
-
operator_multiply
@Pure default double operator_multiply(Vector2D<?,?> v)
Dot product:this * v
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
- Parameters:
v
- the vector- Returns:
- the result.
- See Also:
dot(Vector2D)
-
operator_multiply
@Pure default RV operator_multiply(double factor)
Scale this vector:this * factor
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
The operation
factor * this
is supported byTuple2DExtensions.operator_multiply(double, Vector2D)
.- Parameters:
factor
- the scaling factor.- Returns:
- the scaled vector.
- See Also:
Tuple2D.scale(double)
,Tuple2DExtensions.operator_multiply(double, Vector2D)
-
operator_equals
@Pure default boolean operator_equals(Tuple2D<?> v)
Replies if this vector and the given vector are equal:this == v
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
- Parameters:
v
- the vector.- Returns:
- test result.
- See Also:
Tuple2D.equals(Tuple2D)
-
operator_notEquals
@Pure default boolean operator_notEquals(Tuple2D<?> v)
Replies if this vector and the given vector are different:this != v
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
- Parameters:
v
- the vector.- Returns:
- test result.
- See Also:
Tuple2D.equals(Tuple2D)
-
operator_upTo
@Pure default double operator_upTo(Vector2D<?,?> v)
Replies if the absolute angle between this and v:this .. b
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
- Parameters:
v
- the vector.- Returns:
- the signed angle.
- See Also:
angle(Vector2D)
-
operator_greaterThanDoubleDot
@Pure default double operator_greaterThanDoubleDot(Vector2D<?,?> v)
Replies the signed angle from this to v:this >.. v
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
- Parameters:
v
- the vector.- Returns:
- the signed angle.
- See Also:
signedAngle(Vector2D)
-
operator_doubleDotLessThan
@Pure default double operator_doubleDotLessThan(Vector2D<?,?> v)
Replies the signed angle from v to this:this ..< v
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
- Parameters:
v
- the vector.- Returns:
- the signed angle.
- See Also:
signedAngle(Vector2D)
-
operator_minus
@Pure default RV operator_minus()
Negation of this vector:-this
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
- Returns:
- the result.
- See Also:
Tuple2D.negate(Tuple2D)
-
operator_minus
@Pure default RV operator_minus(Vector2D<?,?> v)
Subtract a vector to this vector:this - v
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
- Parameters:
v
- the vector- Returns:
- the result.
- See Also:
sub(Vector2D)
-
operator_minus
@Pure default RV operator_minus(double scalar)
Subtract a vector to this scalar:this - scalar
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
The operation
scalar - this
is supported byTuple2DExtensions.operator_minus(double, Vector2D)
.- Parameters:
scalar
- the scalar.- Returns:
- the result.
- See Also:
sub(Vector2D)
,Tuple2DExtensions.operator_minus(double, Vector2D)
-
operator_minus
@Pure default RP operator_minus(Point2D<?,?> point)
Subtract a vector to this point:this - point
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
- Parameters:
point
- the point.- Returns:
- the result.
- See Also:
sub(Vector2D)
-
operator_divide
@Pure default RV operator_divide(double factor)
Scale this vector:this / factor
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
The operation
scalar / this
is supported byTuple2DExtensions.operator_divide(double, Vector2D)
.- Parameters:
factor
- the scaling factor- Returns:
- the scaled vector.
- See Also:
Tuple2DExtensions.operator_divide(double, Vector2D)
-
operator_elvis
@Pure default Vector2D<? extends RV,? extends RP> operator_elvis(Vector2D<? extends RV,? extends RP> v)
If this vector is epsilon equal to zero then reply v else reply this:this ?: v
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
- Parameters:
v
- the vector.- Returns:
- the vector.
-
operator_plus
@Pure default RV operator_plus(Vector2D<?,?> v)
Sum of this vector and the given vector:this + v
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
- Parameters:
v
- the vector- Returns:
- the result.
- See Also:
add(Vector2D, Vector2D)
-
operator_plus
@Pure default RP operator_plus(Point2D<?,?> pt)
Add this vector to a point:this + p
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
- Parameters:
pt
- the point.- Returns:
- the result.
- See Also:
Point2D.add(Vector2D, Point2D)
-
operator_plus
@Pure default RV operator_plus(double scalar)
Sum of this vector and the given scalar:this + scalar
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
The operation
scalar + this
is supported byTuple2DExtensions.operator_plus(double, Vector2D)
.- Parameters:
scalar
- the scalar.- Returns:
- the result.
- See Also:
add(Vector2D, Vector2D)
,Tuple2DExtensions.operator_plus(double, Vector2D)
-
operator_power
@Pure default double operator_power(Vector2D<?,?> v)
Perp product of this vector and the given vector:this ** v
.This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
- Parameters:
v
- the other vector.- Returns:
- the result.
- See Also:
perp(Vector2D)
-
operator_power
@Pure default Vector2D.PowerResult<RV> operator_power(int power)
Compute the power of this vector:this ** n
.If the power is even, the result is a scalar. If the power is odd, the result is a vector.
This function is an implementation of the operator for the languages that defined or based on the Xtext framework.
- Parameters:
power
- the power factor.- Returns:
- the power of this vector.
- See Also:
power(int)
, "http://www.euclideanspace.com/maths/algebra/vectors/vecAlgebra/powers/index.htm"
-
$times
@Pure default double $times(Vector2D<?,?> v)
Dot product:this * v
.This function is an implementation of the operator for the Scala Language.
- Parameters:
v
- the vector- Returns:
- the result.
- See Also:
dot(Vector2D)
-
$times
@Pure default RV $times(double factor)
Scale this vector:this * factor
.This function is an implementation of the operator for the Scala Language.
The operation
factor * this
is supported byTuple2DExtensions.$times(double, Vector2D)
.- Parameters:
factor
- the scaling factor.- Returns:
- the scaled vector.
- See Also:
Tuple2D.scale(double)
,Tuple2DExtensions.$times(double, Vector2D)
-
$minus
@Pure default RV $minus()
Negation of this vector:-this
.This function is an implementation of the operator for the Scala Language.
- Returns:
- the result.
- See Also:
Tuple2D.negate(Tuple2D)
-
$minus
@Pure default RV $minus(Vector2D<?,?> v)
Subtract a vector to this vector:this - v
.This function is an implementation of the operator for the Scala Language.
- Parameters:
v
- the vector- Returns:
- the result.
- See Also:
sub(Vector2D)
-
$minus
@Pure default RV $minus(double scalar)
Subtract a vector to this scalar:this - scalar
.This function is an implementation of the operator for the Scala Language.
The operation
scalar - this
is supported byTuple2DExtensions.$minus(double, Vector2D)
.- Parameters:
scalar
- the scalar.- Returns:
- the result.
- See Also:
sub(Vector2D)
,Tuple2DExtensions.$minus(double, Vector2D)
-
$minus
@Pure default RP $minus(Point2D<?,?> point)
Subtract a vector to this point:this - point
.This function is an implementation of the operator for the Scala Language.
- Parameters:
point
- the point.- Returns:
- the result.
- See Also:
sub(Vector2D)
-
$div
@Pure default RV $div(double factor)
Scale this vector:this / factor
.This function is an implementation of the operator for the Scala Language.
The operation
scalar / this
is supported byTuple2DExtensions.$div(double, Vector2D)
.- Parameters:
factor
- the scaling factor- Returns:
- the scaled vector.
- See Also:
Tuple2DExtensions.$div(double, Vector2D)
-
$plus
@Pure default RV $plus(Vector2D<?,?> v)
Sum of this vector and the given vector:this + v
.This function is an implementation of the operator for the Scala Language.
- Parameters:
v
- the vector- Returns:
- the result.
- See Also:
add(Vector2D, Vector2D)
-
$plus
@Pure default RP $plus(Point2D<?,?> pt)
Add this vector to a point:this + p
.This function is an implementation of the operator for the Scala Language.
- Parameters:
pt
- the point.- Returns:
- the result.
- See Also:
Point2D.add(Vector2D, Point2D)
-
$plus
@Pure default RV $plus(double scalar)
Sum of this vector and the given scalar:this + scalar
.This function is an implementation of the operator for the Scala Language.
The operation
scalar + this
is supported byTuple2DExtensions.$plus(double, Vector2D)
.- Parameters:
scalar
- the scalar.- Returns:
- the result.
- See Also:
add(Vector2D, Vector2D)
,Tuple2DExtensions.$plus(double, Vector2D)
-
$up
@Pure default double $up(Vector2D<?,?> v)
Perp product of this vector and the given vector:this ^ v
.This function is an implementation of the operator for the Scala Language.
- Parameters:
v
- the other vector.- Returns:
- the result.
- See Also:
perp(Vector2D)
-
$up
@Pure default Vector2D.PowerResult<RV> $up(int power)
Compute the power of this vector:this ^ n
.If the power is even, the result is a scalar. If the power is odd, the result is a vector.
This function is an implementation of the operator for the Scala Language.
- Parameters:
power
- the power factor.- Returns:
- the power of this vector.
- See Also:
power(int)
, "http://www.euclideanspace.com/maths/algebra/vectors/vecAlgebra/powers/index.htm"
-
-