Class GridVector_2

java.lang.Object
Jcg.geometry.GridVector_2
All Implemented Interfaces:
Vector_

public class GridVector_2 extends Object implements Vector_
  • Field Details

    • x

      public int x
    • y

      public int y
  • Constructor Details

    • GridVector_2

      public GridVector_2()
    • GridVector_2

      public GridVector_2(int x, int y)
    • GridVector_2

      public GridVector_2(GridPoint_2 a, GridPoint_2 b)
  • Method Details

    • getX

      public int getX()
    • getY

      public int getY()
    • setX

      public void setX(int x)
    • setY

      public void setY(int y)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Description copied from interface: Vector_
      Return a String representing vector coordinates
      Specified by:
      toString in interface Vector_
      Overrides:
      toString in class Object
    • dimension

      public int dimension()
      Description copied from interface: Vector_
      Return the dimension of the space
      Specified by:
      dimension in interface Vector_
    • getCartesian

      public Integer getCartesian(int i)
      Description copied from interface: Vector_
      return the i-th cartesian coordinate of the point
      Specified by:
      getCartesian in interface Vector_
    • setCartesian

      public void setCartesian(int i, Number value)
      Description copied from interface: Vector_
      set the i-th cartesian coordinate
      Specified by:
      setCartesian in interface Vector_
    • sum

      public GridVector_2 sum(Vector_ v)
      Description copied from interface: Vector_
      Return the vector sum (v+u), where u is the current vector
      Specified by:
      sum in interface Vector_
    • difference

      public GridVector_2 difference(Vector_ v)
      Description copied from interface: Vector_
      Return the vector difference (v-u), where u is the current vector
      Specified by:
      difference in interface Vector_
    • opposite

      public GridVector_2 opposite()
      Description copied from interface: Vector_
      Return the opposite of the current vector
      Specified by:
      opposite in interface Vector_
    • innerProduct

      public Number innerProduct(Vector_ v)
      A conversion from int to long is necessary to avoid overflows
      Specified by:
      innerProduct in interface Vector_
      Parameters:
      v -
      Returns:
      this . v
    • crossProduct

      public long crossProduct(GridVector_2 v)
      A conversion from int to long is necessary to avoid overflows
      Parameters:
      v -
      Returns:
      this ^ v
    • colinear

      public boolean colinear(GridVector_2 v)
    • divisionByScalar

      public Vector_2 divisionByScalar(Number s)
      Description copied from interface: Vector_
      Return a new vector obtained by scalar division
      Specified by:
      divisionByScalar in interface Vector_
    • multiplyByScalar

      public GridVector_2 multiplyByScalar(Number s)
      Description copied from interface: Vector_
      Return a new vector obtained by multiplying by a scalar
      Specified by:
      multiplyByScalar in interface Vector_
    • squaredLength

      public Number squaredLength()
      Description copied from interface: Vector_
      Return the square length of a vector
      Specified by:
      squaredLength in interface Vector_