Class Vector2D

  • All Implemented Interfaces:
    IVector2D

    public class Vector2D
    extends java.lang.Object
    implements IVector2D
    This class represent a two dimensional vector.
    Author:
    I. Schumacher, modified by 175
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double dx
      The x part of the vector
      private double dy
      The y part of the vector
    • Constructor Summary

      Constructors 
      Constructor Description
      Vector2D​(double dx, double dy)
      This constructor creates a new vector with the given x and y parts.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double getDx()
      Getter for the dx-part
      double getDy()
      Getter for the dy-part
      void rescale()
      Rescale part
      void setDx​(double dx)
      Setter for the dx-part
      void setDy​(double dy)
      Setter for the dy-part
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • dx

        private double dx
        The x part of the vector
      • dy

        private double dy
        The y part of the vector
    • Constructor Detail

      • Vector2D

        public Vector2D​(double dx,
                        double dy)
        This constructor creates a new vector with the given x and y parts.
        Parameters:
        dx - the delta x part for the new vector
        dy - the delty y part for the new vector
    • Method Detail

      • getDx

        public double getDx()
        Getter for the dx-part
        Specified by:
        getDx in interface IVector2D
        Returns:
        dx The dx part of this vector
      • setDx

        public void setDx​(double dx)
        Setter for the dx-part
        Specified by:
        setDx in interface IVector2D
        Parameters:
        dx - The new dx part of this vector
      • getDy

        public double getDy()
        Getter for the dy-part
        Specified by:
        getDy in interface IVector2D
        Returns:
        dy The dy part of this vector
      • setDy

        public void setDy​(double dy)
        Setter for the dy-part
        Specified by:
        setDy in interface IVector2D
        Parameters:
        dy - The new dy part of this vector
      • rescale

        public void rescale()
        Rescale part
        Specified by:
        rescale in interface IVector2D