Interface Vector1D<RV extends Vector1D<? super RV,? super RP,? super RS>,RP extends Point1D<? super RP,? super RV,? super RS>,RS extends Segment1D<?,?>>
-
- 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.RS
- is the type of segment that can be returned by this point.
- All Superinterfaces:
Cloneable
,Comparable<Vector1D<?,?,?>>
,JsonableObject
,Serializable
,Tuple2D<RV>
- All Known Subinterfaces:
UnmodifiableVector1D<RV,RP,RS>
- All Known Implementing Classes:
ImmutableVector1D
,InnerComputationVector1afp
,Vector1d
,Vector1dfx
public interface Vector1D<RV extends Vector1D<? super RV,? super RP,? super RS>,RP extends Point1D<? super RP,? super RV,? super RS>,RS extends Segment1D<?,?>> extends Tuple2D<RV>, Comparable<Vector1D<?,?,?>>
1.5D Vector.- Since:
- 14.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
-
-
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(Point1D<?,?,?> point)
Subtract a vector to this point:this - point
.default RV
$minus(Vector1D<?,?,?> 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(Point1D<?,?,?> pt)
Add this vector to a point:this + p
.default RV
$plus(Vector1D<?,?,?> v)
Sum of this vector and the given vector:this + v
.default RV
$times(double factor)
Scale this vector:this * factor
.default void
add(Vector1D<?,?,?> vector)
Sets the value of this tuple to the sum of itself and the given vector.default void
add(Vector1D<?,?,?> vector1, Vector1D<?,?,?> vector2)
Sets the value of this tuple to the sum of tuples vector1 and vector2.default int
compareTo(Vector1D<?,?,?> vector)
boolean
equals(Object object)
Returns true if the Object t1 is of type Tuple2D and all of the data members of t1 are equal to the corresponding data members in this Tuple2D.default boolean
equals(Vector1D<?,?,?> tuple)
Replies if this point is equals to the given point.GeomFactory1D<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.RS
getSegment()
Replies the segment.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
normalize()
Normalizes this vector in place.default void
normalize(Vector1D<?,?,?> vector)
Sets the value of this vector to the normalization of vector vector.default void
operator_add(Vector1D<?,?,?> v)
Add a vector to this vector:this += v
.default RV
operator_divide(double factor)
Scale this vector:this / factor
.default Vector1D<? extends RV,? extends RP,? extends RS>
operator_elvis(Vector1D<? extends RV,? extends RP,? extends RS> 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 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(Point1D<?,?,?> point)
Subtract a vector to this point:this - point
.default RV
operator_minus(Vector1D<?,?,?> v)
Subtract a vector to this vector:this - v
.default RV
operator_multiply(double factor)
Scale this vector:this * factor
.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(Point1D<?,?,?> pt)
Add this vector to a point:this + p
.default RV
operator_plus(Vector1D<?,?,?> v)
Sum of this vector and the given vector:this + v
.default void
operator_remove(Vector1D<?,?,?> v)
Substract a vector to this vector:this -= v
.default void
scaleAdd(double scale, Vector1D<?,?,?> 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, Vector1D<?,?,?> vector1, Vector1D<?,?,?> 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, Vector1D<?,?,?> 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, Vector1D<?,?,?> t1, Vector1D<?,?,?> 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.default void
sub(Point1D<?,?,?> point1, Point1D<?,?,?> point2)
Sets the value of this tuple to the difference of tuples point1 and point2 (this = point1 - point2).default void
sub(Vector1D<?,?,?> vector)
Sets the value of this tuple to the difference of itself and vector (this = this - vector).default void
sub(Vector1D<?,?,?> vector1, Vector1D<?,?,?> vector2)
Sets the value of this tuple to the difference of tuples vector1 and vector2 (this = vector1 - vector2).default RV
toUnitVector()
Replies the unit vector of this vector.UnmodifiableVector1D<RV,RP,RS>
toUnmodifiable()
Replies an unmodifiable copy of this vector.-
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, 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
-
compareTo
default int compareTo(Vector1D<?,?,?> vector)
-
getSegment
@Pure RS getSegment()
Replies the segment.- Returns:
- the segment or
null
if the weak reference has lost the segment.
-
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.
-
equals
boolean equals(Object object)
Description copied from interface:Tuple2D
Returns true if the Object t1 is of type Tuple2D and all of the data members of t1 are equal to the corresponding data members in this Tuple2D.
-
equals
@Pure default boolean equals(Vector1D<?,?,?> tuple)
Replies if this point is equals to the given point.- Parameters:
tuple
- the tuple- Returns:
true
if this point has the same coordinates on the same segment as for the given point.
-
add
default void add(Vector1D<?,?,?> vector1, Vector1D<?,?,?> 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(Vector1D<?,?,?> 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, Vector1D<?,?,?> t1, Vector1D<?,?,?> 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, Vector1D<?,?,?> vector1, Vector1D<?,?,?> 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, Vector1D<?,?,?> 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, Vector1D<?,?,?> 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(Vector1D<?,?,?> vector1, Vector1D<?,?,?> 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(Point1D<?,?,?> point1, Point1D<?,?,?> 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(Vector1D<?,?,?> vector)
Sets the value of this tuple to the difference of itself and vector (this = this - vector).- Parameters:
vector
- the other tuple
-
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(Vector1D<?,?,?> 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.
-
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 UnmodifiableVector1D<RV,RP,RS> toUnmodifiable()
Replies an unmodifiable copy of this vector.- Returns:
- an unmodifiable copy.
-
getGeomFactory
@Pure GeomFactory1D<RV,RP> getGeomFactory()
Replies the geometry factory associated to this point.- Returns:
- the factory.
-
operator_add
default void operator_add(Vector1D<?,?,?> 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(Vector1D)
-
operator_remove
default void operator_remove(Vector1D<?,?,?> 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(Vector1D)
-
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, Vector1D)
.- Parameters:
factor
- the scaling factor.- Returns:
- the scaled vector.
- See Also:
Tuple2D.scale(double)
,Tuple2DExtensions.operator_multiply(double, Vector1D)
-
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_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(Vector1D<?,?,?> 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(Vector1D)
-
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, Vector1D)
.- Parameters:
scalar
- the scalar.- Returns:
- the result.
- See Also:
sub(Vector1D)
,Tuple2DExtensions.operator_minus(double, Vector1D)
-
operator_minus
@Pure default RP operator_minus(Point1D<?,?,?> 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(Vector1D)
-
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, Vector1D)
.- Parameters:
factor
- the scaling factor- Returns:
- the scaled vector.
- See Also:
Tuple2DExtensions.operator_divide(double, Vector1D)
-
operator_elvis
@Pure default Vector1D<? extends RV,? extends RP,? extends RS> operator_elvis(Vector1D<? extends RV,? extends RP,? extends RS> 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(Vector1D<?,?,?> 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(Vector1D, Vector1D)
-
operator_plus
@Pure default RP operator_plus(Point1D<?,?,?> 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.
-
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, Vector1D)
.- Parameters:
scalar
- the scalar.- Returns:
- the result.
- See Also:
add(Vector1D, Vector1D)
-
$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, Vector1D)
.- Parameters:
factor
- the scaling factor.- Returns:
- the scaled vector.
- See Also:
Tuple2D.scale(double)
,Tuple2DExtensions.$times(double, Vector1D)
-
$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(Vector1D<?,?,?> 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(Vector1D)
-
$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, Vector1D)
.- Parameters:
scalar
- the scalar.- Returns:
- the result.
- See Also:
sub(Vector1D)
,Tuple2DExtensions.$minus(double, Vector1D)
-
$minus
@Pure default RP $minus(Point1D<?,?,?> 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(Vector1D)
-
$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, Vector1D)
.- Parameters:
factor
- the scaling factor- Returns:
- the scaled vector.
- See Also:
Tuple2DExtensions.$div(double, Vector1D)
-
$plus
@Pure default RV $plus(Vector1D<?,?,?> 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(Vector1D, Vector1D)
-
$plus
@Pure default RP $plus(Point1D<?,?,?> 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.
-
$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, Vector1D)
.- Parameters:
scalar
- the scalar.- Returns:
- the result.
- See Also:
add(Vector1D, Vector1D)
,Tuple2DExtensions.$plus(double, Vector1D)
-
-