Interface Vector1D<RV extends Vector1D<? super RV,​? super RP,​? super RS>,​RP extends Point1D<? super RP,​? super RV,​? super RS>,​RS extends Segment1D<?,​?>>

    • Method Detail

      • 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,
                                    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.
        Specified by:
        equals in interface Tuple2D<RV extends Vector1D<? super RV,​? super RP,​? super RS>>
        Overrides:
        equals in class Object
        Parameters:
        object - the object with which the comparison is made
        Returns:
        true or false
      • 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 tuple
        vector2 - 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 value
        t1 - the tuple to be multipled
        t2 - 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 value
        vector1 - the tuple to be multipled
        vector2 - 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 value
        vector - 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 value
        vector - 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 tuple
        vector2 - 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 tuple
        point2 - 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_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 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_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.
      • $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 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)
      • $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.