Class Vector1d

    • Constructor Detail

      • Vector1d

        public Vector1d​(Vector1D<?,​?,​?> tuple)
        Construct a zero vector.
        Parameters:
        tuple - the tuple to copy.
      • Vector1d

        public Vector1d​(Point1D<?,​?,​?> tuple)
        Construct a zero vector.
        Parameters:
        tuple - the tuple to copy.
      • Vector1d

        public Vector1d​(Segment1D<?,​?> segment)
        Construct a zero vector.
        Parameters:
        segment - the segment associated to the vector.
      • Vector1d

        public Vector1d()
        Construct a zero vector.
      • Vector1d

        public Vector1d​(Segment1D<?,​?> segment,
                        Tuple2D<?> tuple)
        Constructor by copy.
        Parameters:
        segment - the segment associated to the vector.
        tuple - is the tuple to copy.
      • Vector1d

        public Vector1d​(Segment1D<?,​?> segment,
                        int[] tuple)
        Constructor by copy.
        Parameters:
        segment - the segment associated to the vector.
        tuple - is the tuple to copy.
      • Vector1d

        public Vector1d​(Segment1D<?,​?> segment,
                        double[] tuple)
        Constructor by copy.
        Parameters:
        segment - the segment associated to the vector.
        tuple - is the tuple to copy.
      • Vector1d

        public Vector1d​(Segment1D<?,​?> segment,
                        int x,
                        int y)
        Construct a vector with the given coordinates.
        Parameters:
        segment - the segment associated to the vector.
        x - x coordinate.
        y - y coordinate.
      • Vector1d

        public Vector1d​(Segment1D<?,​?> segment,
                        float x,
                        float y)
        Construct a vector with the given coordinates.
        Parameters:
        segment - the segment associated to the vector.
        x - x coordinate.
        y - y coordinate.
      • Vector1d

        public Vector1d​(Segment1D<?,​?> segment,
                        double x,
                        double y)
        Construct a vector with the given coordinates.
        Parameters:
        segment - the segment associated to the vector.
        x - x coordinate.
        y - y coordinate.
      • Vector1d

        public Vector1d​(Segment1D<?,​?> segment,
                        long x,
                        long y)
        Construct a vector with the given coordinates.
        Parameters:
        segment - the segment associated to the vector.
        x - x coordinate.
        y - y coordinate.
    • Method Detail

      • convert

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

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

        Parameters:
        tuple - the tuple.
        Returns:
        the Vector1d.
        Since:
        14.0
      • getLength

        @Pure
        public double getLength()
        Description copied from interface: Vector1D
        Returns the length of this vector.
        Specified by:
        getLength in interface Vector1D<Vector1d,​Point1d,​Segment1D<?,​?>>
        Returns:
        the length of this vector
      • getLengthSquared

        @Pure
        public double getLengthSquared()
        Description copied from interface: Vector1D
        Returns the squared length of this vector.
        Specified by:
        getLengthSquared in interface Vector1D<Vector1d,​Point1d,​Segment1D<?,​?>>
        Returns:
        the squared length of this vector
      • add

        public void add​(Vector1D<?,​?,​?> vector1,
                        Vector1D<?,​?,​?> vector2)
        Description copied from interface: Vector1D
        Sets the value of this tuple to the sum of tuples vector1 and vector2.
        Specified by:
        add in interface Vector1D<Vector1d,​Point1d,​Segment1D<?,​?>>
        Parameters:
        vector1 - the first tuple
        vector2 - the second tuple
      • add

        public void add​(Vector1D<?,​?,​?> vector)
        Description copied from interface: Vector1D
        Sets the value of this tuple to the sum of itself and the given vector.
        Specified by:
        add in interface Vector1D<Vector1d,​Point1d,​Segment1D<?,​?>>
        Parameters:
        vector - the other tuple
      • scaleAdd

        public void scaleAdd​(int scale,
                             Vector1D<?,​?,​?> vector1,
                             Vector1D<?,​?,​?> vector2)
        Description copied from interface: Vector1D
        Sets the value of this tuple to the scalar multiplication of tuple t1 plus tuple t2 (this = s*t1 + t2).
        Specified by:
        scaleAdd in interface Vector1D<Vector1d,​Point1d,​Segment1D<?,​?>>
        Parameters:
        scale - the scalar value
        vector1 - the tuple to be multipled
        vector2 - the tuple to be added
      • scaleAdd

        public void scaleAdd​(double scale,
                             Vector1D<?,​?,​?> vector1,
                             Vector1D<?,​?,​?> vector2)
        Description copied from interface: Vector1D
        Sets the value of this tuple to the scalar multiplication of the tuple vector1 plus the tuple vector2 (this = s*vector1 + vector2).
        Specified by:
        scaleAdd in interface Vector1D<Vector1d,​Point1d,​Segment1D<?,​?>>
        Parameters:
        scale - the scalar value
        vector1 - the tuple to be multipled
        vector2 - the tuple to be added
      • scaleAdd

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

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

        public void sub​(Vector1D<?,​?,​?> vector1,
                        Vector1D<?,​?,​?> vector2)
        Description copied from interface: Vector1D
        Sets the value of this tuple to the difference of tuples vector1 and vector2 (this = vector1 - vector2).
        Specified by:
        sub in interface Vector1D<Vector1d,​Point1d,​Segment1D<?,​?>>
        Parameters:
        vector1 - the first tuple
        vector2 - the second tuple
      • sub

        public void sub​(Point1D<?,​?,​?> point1,
                        Point1D<?,​?,​?> point2)
        Description copied from interface: Vector1D
        Sets the value of this tuple to the difference of tuples point1 and point2 (this = point1 - point2).
        Specified by:
        sub in interface Vector1D<Vector1d,​Point1d,​Segment1D<?,​?>>
        Parameters:
        point1 - the first tuple
        point2 - the second tuple
      • sub

        public void sub​(Vector1D<?,​?,​?> vector)
        Description copied from interface: Vector1D
        Sets the value of this tuple to the difference of itself and vector (this = this - vector).
        Specified by:
        sub in interface Vector1D<Vector1d,​Point1d,​Segment1D<?,​?>>
        Parameters:
        vector - the other tuple
      • setLength

        public void setLength​(double newLength)
        Description copied from interface: Vector1D
        Change the length of the vector. The direction of the vector is unchanged.
        Specified by:
        setLength in interface Vector1D<Vector1d,​Point1d,​Segment1D<?,​?>>
        Parameters:
        newLength - - the new length.