Class Point2d

    • Constructor Detail

      • Point2d

        public Point2d()
        Construct a zero point.
      • Point2d

        public Point2d​(Tuple2D<?> tuple)
        Constructor by copy.
        Parameters:
        tuple - is the tuple to copy.
      • Point2d

        public Point2d​(int[] tuple)
        Constructor.
        Parameters:
        tuple - is the tuple to copy.
      • Point2d

        public Point2d​(double[] tuple)
        Constructor.
        Parameters:
        tuple - is the tuple to copy.
      • Point2d

        public Point2d​(int x,
                       int y)
        Construct a point with the given coordinates.
        Parameters:
        x - x coordinate.
        y - y coordinate.
      • Point2d

        public Point2d​(float x,
                       float y)
        Construct a point with the given coordinates.
        Parameters:
        x - x coordinate.
        y - y coordinate.
      • Point2d

        public Point2d​(double x,
                       double y)
        Construct a point with the given coordinates.
        Parameters:
        x - x coordinate.
        y - y coordinate.
      • Point2d

        public Point2d​(long x,
                       long y)
        Construct a point with the given coordinates.
        Parameters:
        x - x coordinate.
        y - y coordinate.
    • Method Detail

      • convert

        public static Point2d convert​(Tuple2D<?> tuple)
        Convert the given tuple to a real Point2d.

        If the given tuple is already a Point2d, it is replied.

        Parameters:
        tuple - the tuple.
        Returns:
        the Point2d.
        Since:
        14.0
      • getDistanceSquared

        @Pure
        public double getDistanceSquared​(Point2D<?,​?> pt)
        Description copied from interface: Point2D
        Computes the square of the distance between this point and point p1.
        Specified by:
        getDistanceSquared in interface Point2D<Point2d,​Vector2d>
        Parameters:
        pt - the other point
        Returns:
        the distance.
      • getDistance

        @Pure
        public double getDistance​(Point2D<?,​?> pt)
        Description copied from interface: Point2D
        Computes the distance between this point and point p1.
        Specified by:
        getDistance in interface Point2D<Point2d,​Vector2d>
        Parameters:
        pt - the other point
        Returns:
        the distance.
      • getDistanceL1

        @Pure
        public double getDistanceL1​(Point2D<?,​?> pt)
        Description copied from interface: Point2D
        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).
        Specified by:
        getDistanceL1 in interface Point2D<Point2d,​Vector2d>
        Parameters:
        pt - the other point
        Returns:
        the distance.
      • getDistanceLinf

        @Pure
        public double getDistanceLinf​(Point2D<?,​?> pt)
        Description copied from interface: Point2D
        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)].
        Specified by:
        getDistanceLinf in interface Point2D<Point2d,​Vector2d>
        Parameters:
        pt - the other point
        Returns:
        the distance.
      • getIdistanceL1

        @Pure
        public int getIdistanceL1​(Point2D<?,​?> pt)
        Description copied from interface: Point2D
        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).
        Specified by:
        getIdistanceL1 in interface Point2D<Point2d,​Vector2d>
        Parameters:
        pt - the other point
        Returns:
        the distance.
      • getIdistanceLinf

        @Pure
        public int getIdistanceLinf​(Point2D<?,​?> pt)
        Description copied from interface: Point2D
        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)].
        Specified by:
        getIdistanceLinf in interface Point2D<Point2d,​Vector2d>
        Parameters:
        pt - the other point
        Returns:
        the distance.
      • add

        public void add​(Point2D<?,​?> point,
                        Vector2D<?,​?> vector)
        Description copied from interface: Point2D
        Sets the value of this tuple to the sum of tuples t1 and t2.
        Specified by:
        add in interface Point2D<Point2d,​Vector2d>
        Parameters:
        point - the first tuple
        vector - the second tuple
      • add

        public void add​(Vector2D<?,​?> vector,
                        Point2D<?,​?> point)
        Description copied from interface: Point2D
        Sets the value of this tuple to the sum of tuples t1 and t2.
        Specified by:
        add in interface Point2D<Point2d,​Vector2d>
        Parameters:
        vector - the first tuple
        point - the second tuple
      • add

        public void add​(Vector2D<?,​?> vector)
        Description copied from interface: Point2D
        Sets the value of this tuple to the sum of itself and t1.
        Specified by:
        add in interface Point2D<Point2d,​Vector2d>
        Parameters:
        vector - the other tuple
      • scaleAdd

        public void scaleAdd​(int scale,
                             Vector2D<?,​?> vector,
                             Point2D<?,​?> point)
        Description copied from interface: Point2D
        Sets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*vector + point).
        Specified by:
        scaleAdd in interface Point2D<Point2d,​Vector2d>
        Parameters:
        scale - the scalar value
        vector - the tuple to be multipled
        point - the tuple to be added
      • scaleAdd

        public void scaleAdd​(double scale,
                             Vector2D<?,​?> vector,
                             Point2D<?,​?> point)
        Description copied from interface: Point2D
        Sets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*vector + point).
        Specified by:
        scaleAdd in interface Point2D<Point2d,​Vector2d>
        Parameters:
        scale - the scalar value
        vector - the tuple to be multipled
        point - the tuple to be added
      • scaleAdd

        public void scaleAdd​(int scale,
                             Point2D<?,​?> point,
                             Vector2D<?,​?> vector)
        Description copied from interface: Point2D
        Sets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*point + vector).
        Specified by:
        scaleAdd in interface Point2D<Point2d,​Vector2d>
        Parameters:
        scale - the scalar value
        point - the tuple to be multipled
        vector - the tuple to be added
      • scaleAdd

        public void scaleAdd​(double scale,
                             Point2D<?,​?> point,
                             Vector2D<?,​?> vector)
        Description copied from interface: Point2D
        Sets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*point + vector).
        Specified by:
        scaleAdd in interface Point2D<Point2d,​Vector2d>
        Parameters:
        scale - the scalar value
        point - the tuple to be multipled
        vector - the tuple to be added
      • scaleAdd

        public void scaleAdd​(int scale,
                             Vector2D<?,​?> vector)
        Description copied from interface: Point2D
        Sets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + vector).
        Specified by:
        scaleAdd in interface Point2D<Point2d,​Vector2d>
        Parameters:
        scale - the scalar value
        vector - the tuple to be added
      • scaleAdd

        public void scaleAdd​(double scale,
                             Vector2D<?,​?> vector)
        Description copied from interface: Point2D
        Sets the value of this tuple to the scalar multiplication of itself and then adds tuple t1 (this = s*this + vector).
        Specified by:
        scaleAdd in interface Point2D<Point2d,​Vector2d>
        Parameters:
        scale - the scalar value
        vector - the tuple to be added
      • sub

        public void sub​(Point2D<?,​?> point,
                        Vector2D<?,​?> vector)
        Description copied from interface: Point2D
        Sets the value of this tuple to the difference of tuples point and vector (this = point - vector).
        Specified by:
        sub in interface Point2D<Point2d,​Vector2d>
        Parameters:
        point - the first tuple
        vector - the second tuple
      • sub

        public void sub​(Vector2D<?,​?> vector)
        Description copied from interface: Point2D
        Sets the value of this tuple to the difference of itself and the given vector (this = this - vector).
        Specified by:
        sub in interface Point2D<Point2d,​Vector2d>
        Parameters:
        vector - the other tuple