Interface Point2D<RP extends Point2D<? super RP,​? super RV>,​RV extends Vector2D<? super RV,​? super RP>>

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default boolean $amp$amp​(Shape2D<?,​?,​?,​?,​?,​?> shape)
      Replies if the this point is inside the given shape: this && s.
      default RP $minus​(double scalar)
      Subtract the scalar to this point: this - scalar.
      default RV $minus​(Point2D<?,​?> pt)
      Subtract the p point to this point: this - p.
      default RP $minus​(Vector2D<?,​?> v)
      Subtract the v vector to this point: this - v.
      default RP $plus​(double scalar)
      Sum of this point and a scalar: this + scalar.
      default RP $plus​(Vector2D<?,​?> v)
      Sum of this point and a vector: this + v.
      default void add​(Point2D<?,​?> point, Vector2D<?,​?> vector)
      Sets the value of this tuple to the sum of tuples t1 and t2.
      default void add​(Vector2D<?,​?> vector)
      Sets the value of this tuple to the sum of itself and t1.
      default void add​(Vector2D<?,​?> vector, Point2D<?,​?> point)
      Sets the value of this tuple to the sum of tuples t1 and t2.
      default double getDistance​(Point2D<?,​?> point)
      Computes the distance between this point and point p1.
      default double getDistanceL1​(Point2D<?,​?> point)
      Computes the L-1 (Manhattan) distance between this point and point p1.
      static double getDistanceL1PointPoint​(double x1, double y1, double x2, double y2)
      Compute the L-1 (Manhattan) distance between 2 points.
      default double getDistanceLinf​(Point2D<?,​?> point)
      Computes the L-infinite distance between this point and point p1.
      static double getDistanceLinfPointPoint​(double x1, double y1, double x2, double y2)
      Compute the L-infinite distance between 2 points.
      static double getDistancePointPoint​(double x1, double y1, double x2, double y2)
      Compute the distance between 2 points.
      default double getDistanceSquared​(Point2D<?,​?> point)
      Computes the square of the distance between this point and point p1.
      static double getDistanceSquaredPointPoint​(double x1, double y1, double x2, double y2)
      Compute the squared distance between 2 points.
      GeomFactory2D<RV,​RP> getGeomFactory()
      Replies the geometry factory associated to this point.
      default int getIdistanceL1​(Point2D<?,​?> point)
      Computes the L-1 (Manhattan) distance between this point and point p1.
      default int getIdistanceLinf​(Point2D<?,​?> point)
      Computes the L-infinite distance between this point and point p1.
      static boolean isCollinearPoints​(double x1, double y1, double x2, double y2, double x3, double y3)
      Replies if three points are colinear, ie. one the same line.
      default void operator_add​(Vector2D<?,​?> v)
      Increment this point with the given vector: this += v.
      default boolean operator_and​(Shape2D<?,​?,​?,​?,​?,​?> shape)
      Replies if the this point is inside the given shape: this && s.
      default Point2D<? extends RP,​? extends RV> operator_elvis​(Point2D<? extends RP,​? extends RV> pt)
      If this point is epsilon equal to zero then reply p else reply this: this ?: p.
      default boolean operator_equals​(Tuple2D<?> v)
      Replies if the given vector is equal to this vector: this == v.
      default RP operator_minus​(double scalar)
      Subtract the scalar to this point: this - scalar.
      default RV operator_minus​(Point2D<?,​?> pt)
      Subtract the p point to this point: this - p.
      default RP operator_minus​(Vector2D<?,​?> v)
      Subtract the v vector to this point: this - v.
      default boolean operator_notEquals​(Tuple2D<?> v)
      Replies if the given vector is different than this vector: this != v.
      default RP operator_plus​(double scalar)
      Sum of this point and a scalar: this + scalar.
      default RP operator_plus​(Vector2D<?,​?> v)
      Sum of this point and a vector: this + v.
      default void operator_remove​(Vector2D<?,​?> v)
      Subtract the v vector to this: this -= v.
      default double operator_upTo​(Point2D<?,​?> pt)
      Replies if the distance between this and the p point: this .. p.
      default double operator_upTo​(Shape2D<?,​?,​?,​?,​?,​?> shape)
      Replies the distance between this point and the given shape: this .. s.
      default void scaleAdd​(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).
      default void scaleAdd​(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).
      default void scaleAdd​(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).
      default void scaleAdd​(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).
      default void scaleAdd​(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).
      default void scaleAdd​(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).
      default void sub​(Point2D<?,​?> point, Vector2D<?,​?> vector)
      Sets the value of this tuple to the difference of tuples point and vector (this = point - vector).
      default void sub​(Vector2D<?,​?> vector)
      Sets the value of this tuple to the difference of itself and the given vector (this = this - vector).
      UnmodifiablePoint2D<RP,​RV> toUnmodifiable()
      Replies an unmodifiable copy of this point.
      default void turn​(double angle)
      Turn this point about the given rotation angle around the origin point.
      default void turn​(double angle, Point2D<?,​?> pointToTurn)
      Turn the given point about the given rotation angle around the origin point, and set this point with the result.
      default void turn​(double angle, Point2D<?,​?> pointToTurn, Point2D<?,​?> origin)
      Turn the given point about the given rotation angle around the origin point, and set this point with the result.
      default void turnLeft​(double angle)
      Turn this vector on the left around the origin when the given rotation angle is positive.
      default void turnLeft​(double angle, Point2D<?,​?> pointToTurn)
      Turn the given vector on the left, and set this vector with the result.
      default void turnLeft​(double angle, Point2D<?,​?> pointToTurn, Point2D<?,​?> origin)
      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 around the origin when the given rotation angle is positive.
      default void turnRight​(double angle, Point2D<?,​?> pointToTurn)
      Turn this vector on the right around the origin when the given rotation angle is positive.
      default void turnRight​(double angle, Point2D<?,​?> pointToTurn, Point2D<?,​?> origin)
      Turn this vector on the right around the origin when the given rotation angle is positive.
    • Method Detail

      • isCollinearPoints

        @Pure
        static boolean isCollinearPoints​(double x1,
                                         double y1,
                                         double x2,
                                         double y2,
                                         double x3,
                                         double y3)
        Replies if three points are colinear, ie. one the same line.

        Trival approach is: points are collinear iff |AB| + |AC| = |BC|, where A B C are the three points.

        This function uses the equal-to-zero test with the error Math.ulp(double).

        Parameters:
        x1 - is the X coordinate of the first point
        y1 - is the Y coordinate of the first point
        x2 - is the X coordinate of the second point
        y2 - is the Y coordinate of the second point
        x3 - is the X coordinate of the third point
        y3 - is the Y coordinate of the third point
        Returns:
        true if the three given points are colinear.
        Since:
        3.0
        See Also:
        MathUtil.isEpsilonZero(double)
      • getDistanceSquaredPointPoint

        @Pure
        static double getDistanceSquaredPointPoint​(double x1,
                                                   double y1,
                                                   double x2,
                                                   double y2)
        Compute the squared distance between 2 points.
        Parameters:
        x1 - horizontal position of the first point.
        y1 - vertical position of the first point.
        x2 - horizontal position of the second point.
        y2 - vertical position of the second point.
        Returns:
        the squared distance between given points.
        See Also:
        getDistancePointPoint(double, double, double, double), getDistanceL1PointPoint(double, double, double, double)
      • getDistanceL1PointPoint

        @Pure
        static double getDistanceL1PointPoint​(double x1,
                                              double y1,
                                              double x2,
                                              double y2)
        Compute the L-1 (Manhattan) distance between 2 points. The L-1 distance is equal to abs(x1-x2) + abs(y1-y2).
        Parameters:
        x1 - horizontal position of the first point.
        y1 - vertical position of the first point.
        x2 - horizontal position of the second point.
        y2 - vertical position of the second point.
        Returns:
        the distance between given points.
        See Also:
        getDistancePointPoint(double, double, double, double), getDistanceSquaredPointPoint(double, double, double, double)
      • getDistanceLinfPointPoint

        @Pure
        static double getDistanceLinfPointPoint​(double x1,
                                                double y1,
                                                double x2,
                                                double y2)
        Compute the L-infinite distance between 2 points. The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2)].
        Parameters:
        x1 - horizontal position of the first point.
        y1 - vertical position of the first point.
        x2 - horizontal position of the second point.
        y2 - vertical position of the second point.
        Returns:
        the distance between given points.
        See Also:
        getDistancePointPoint(double, double, double, double), getDistanceSquaredPointPoint(double, double, double, double)
      • getDistanceSquared

        @Pure
        default double getDistanceSquared​(Point2D<?,​?> point)
        Computes the square of the distance between this point and point p1.
        Parameters:
        point - the other point
        Returns:
        the distance.
      • getDistance

        @Pure
        default double getDistance​(Point2D<?,​?> point)
        Computes the distance between this point and point p1.
        Parameters:
        point - the other point
        Returns:
        the distance.
      • getDistanceL1

        @Pure
        default double getDistanceL1​(Point2D<?,​?> point)
        Computes the L-1 (Manhattan) distance between this point and point p1. The L-1 distance is equal to abs(x1-x2) + abs(y1-y2).
        Parameters:
        point - the other point
        Returns:
        the distance.
      • getDistanceLinf

        @Pure
        default double getDistanceLinf​(Point2D<?,​?> point)
        Computes the L-infinite distance between this point and point p1. The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2)].
        Parameters:
        point - the other point
        Returns:
        the distance.
      • getIdistanceL1

        @Pure
        default int getIdistanceL1​(Point2D<?,​?> point)
        Computes the L-1 (Manhattan) distance between this point and point p1. The L-1 distance is equal to abs(x1-x2) + abs(y1-y2).
        Parameters:
        point - the other point
        Returns:
        the distance.
      • getIdistanceLinf

        @Pure
        default int getIdistanceLinf​(Point2D<?,​?> point)
        Computes the L-infinite distance between this point and point p1. The L-infinite distance is equal to MAX[abs(x1-x2), abs(y1-y2)].
        Parameters:
        point - the other point
        Returns:
        the distance.
      • add

        default void add​(Point2D<?,​?> point,
                         Vector2D<?,​?> vector)
        Sets the value of this tuple to the sum of tuples t1 and t2.
        Parameters:
        point - the first tuple
        vector - the second tuple
      • add

        default void add​(Vector2D<?,​?> vector,
                         Point2D<?,​?> point)
        Sets the value of this tuple to the sum of tuples t1 and t2.
        Parameters:
        vector - the first tuple
        point - the second tuple
      • add

        default void add​(Vector2D<?,​?> vector)
        Sets the value of this tuple to the sum of itself and t1.
        Parameters:
        vector - the other tuple
      • scaleAdd

        default void scaleAdd​(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).
        Parameters:
        scale - the scalar value
        vector - the tuple to be multipled
        point - the tuple to be added
      • scaleAdd

        default void scaleAdd​(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).
        Parameters:
        scale - the scalar value
        vector - the tuple to be multipled
        point - the tuple to be added
      • scaleAdd

        default void scaleAdd​(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).
        Parameters:
        scale - the scalar value
        point - the tuple to be multipled
        vector - the tuple to be added
      • scaleAdd

        default void scaleAdd​(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).
        Parameters:
        scale - the scalar value
        point - the tuple to be multipled
        vector - 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 t1 (this = s*this + vector).
        Parameters:
        scale - the scalar value
        vector - 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 t1 (this = s*this + vector).
        Parameters:
        scale - the scalar value
        vector - the tuple to be added
      • sub

        default void sub​(Point2D<?,​?> point,
                         Vector2D<?,​?> vector)
        Sets the value of this tuple to the difference of tuples point and vector (this = point - vector).
        Parameters:
        point - the first tuple
        vector - the second tuple
      • sub

        default void sub​(Vector2D<?,​?> vector)
        Sets the value of this tuple to the difference of itself and the given vector (this = this - vector).
        Parameters:
        vector - the other tuple
      • toUnmodifiable

        @Pure
        UnmodifiablePoint2D<RP,​RV> toUnmodifiable()
        Replies an unmodifiable copy of this point.
        Returns:
        an unmodifiable copy.
      • getGeomFactory

        @Pure
        GeomFactory2D<RV,​RP> getGeomFactory()
        Replies the geometry factory associated to this point.
        Returns:
        the factory.
      • operator_plus

        @Pure
        default RP operator_plus​(Vector2D<?,​?> v)
        Sum of this point and a 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 to add
        Returns:
        the result.
        See Also:
        add(Point2D, Vector2D)
      • operator_add

        default void operator_add​(Vector2D<?,​?> v)
        Increment this point with 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 to add
        See Also:
        add(Vector2D)
      • operator_minus

        @Pure
        default RP operator_minus​(Vector2D<?,​?> v)
        Subtract the v vector to this point: 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 to substract.
        Returns:
        the result.
        See Also:
        sub(Point2D, Vector2D)
      • operator_minus

        @Pure
        default RV operator_minus​(Point2D<?,​?> pt)
        Subtract the p point to this 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 to substract
        Returns:
        the vector from the p to this.
        See Also:
        Vector2D.sub(Point2D, Point2D)
      • operator_remove

        default void operator_remove​(Vector2D<?,​?> v)
        Subtract the v vector 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 to substract.
        See Also:
        sub(Vector2D)
      • operator_equals

        @Pure
        default boolean operator_equals​(Tuple2D<?> v)
        Replies if the given vector is equal 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:
        test result.
        See Also:
        Tuple2D.equals(Tuple2D)
      • operator_notEquals

        @Pure
        default boolean operator_notEquals​(Tuple2D<?> v)
        Replies if the given vector is different than 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:
        test result.
        See Also:
        Tuple2D.equals(Tuple2D)
      • operator_upTo

        @Pure
        default double operator_upTo​(Point2D<?,​?> pt)
        Replies if the distance between this and the p 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 distance.
        See Also:
        getDistance(Point2D)
      • operator_upTo

        @Pure
        default double operator_upTo​(Shape2D<?,​?,​?,​?,​?,​?> shape)
        Replies the distance between this point and the given shape: this .. s.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        shape - the shape to test.
        Returns:
        the distance.
        See Also:
        Shape2D.getDistance(Point2D)
      • operator_elvis

        @Pure
        default Point2D<? extends RP,​? extends RV> operator_elvis​(Point2D<? extends RP,​? extends RV> pt)
        If this point is epsilon equal to zero then reply p else reply this: 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 point.
      • operator_and

        @Pure
        default boolean operator_and​(Shape2D<?,​?,​?,​?,​?,​?> shape)
        Replies if the this point is inside the given shape: this && s.

        This function is an implementation of the operator for the languages that defined or based on the Xtext framework.

        Parameters:
        shape - the shape to test.
        Returns:
        true if the point is inside the shape. Otherwise, false.
        See Also:
        Shape2D.contains(Point2D)
      • $plus

        @Pure
        default RP $plus​(Vector2D<?,​?> v)
        Sum of this point and a vector: this + v.

        This function is an implementation of the operator for the Scala Language.

        Parameters:
        v - the vector to add
        Returns:
        the result.
        See Also:
        add(Point2D, Vector2D)
      • $minus

        @Pure
        default RP $minus​(Vector2D<?,​?> v)
        Subtract the v vector to this point: this - v.

        This function is an implementation of the operator for the Scala Language.

        Parameters:
        v - the vector to substract.
        Returns:
        the result.
        See Also:
        sub(Point2D, Vector2D)
      • $minus

        @Pure
        default RV $minus​(Point2D<?,​?> pt)
        Subtract the p point to this point: this - p.

        This function is an implementation of the operator for the Scala Language.

        Parameters:
        pt - the point to substract
        Returns:
        the vector from the p to this.
        See Also:
        Vector2D.sub(Point2D, Point2D)
      • $amp$amp

        @Pure
        default boolean $amp$amp​(Shape2D<?,​?,​?,​?,​?,​?> shape)
        Replies if the this point is inside the given shape: this && s.

        This function is an implementation of the operator for the Scala Language.

        Parameters:
        shape - the shape to test.
        Returns:
        true if the point is inside the shape. Otherwise, false.
        See Also:
        Shape2D.contains(Point2D)
      • turn

        default void turn​(double angle)
        Turn this point about the given rotation angle around the origin point.

        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, Point2D, Point2D), turnLeft(double), turnRight(double)
      • turn

        default void turn​(double angle,
                          Point2D<?,​?> pointToTurn)
        Turn the given point about the given rotation angle around the origin point, and set this point 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.
        pointToTurn - the point to turn.
        See Also:
        turn(double, Point2D, Point2D), turn(double), turnLeft(double), turnRight(double)
      • turn

        default void turn​(double angle,
                          Point2D<?,​?> pointToTurn,
                          Point2D<?,​?> origin)
        Turn the given point about the given rotation angle around the origin point, and set this point 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.
        pointToTurn - the point to turn.
        origin - the origin point.
        See Also:
        turn(double, Point2D), turn(double), turnLeft(double), turnRight(double)
      • turnRight

        default void turnRight​(double angle)
        Turn this vector on the right around the origin 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,
                               Point2D<?,​?> pointToTurn)
        Turn this vector on the right around the origin 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.
        pointToTurn - the vector to turn.
        See Also:
        CoordinateSystem2D, turn(double), turnLeft(double)
      • turnRight

        default void turnRight​(double angle,
                               Point2D<?,​?> pointToTurn,
                               Point2D<?,​?> origin)
        Turn this vector on the right around the origin 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.
        pointToTurn - the vector to turn.
        origin - the origin point.
        See Also:
        CoordinateSystem2D, turn(double), turnLeft(double)