Module id.matcv
Package id.mathcalc

Class Vector3d

Object
Vector3d

public class Vector3d extends Object
Vector which contains three doubles.

Vector itself is immutable all public fields are final.

All operations are immutable and return new copy of the vector.

  • Field Details

    • n1

      public final double n1
    • n2

      public final double n2
    • n3

      public final double n3
  • Constructor Details

    • Vector3d

      public Vector3d()
    • Vector3d

      public Vector3d(Vector3d vec)
    • Vector3d

      public Vector3d(double n1, double n2, double n3)
  • Method Details

    • norm

      public double norm()
      L2 norm, equals to the square root of the dot product of vector with itself.
    • normalize

      public Vector3d normalize()
      Normalizes the vector, i.e. divides it by its own norm
    • mul

      public Vector3d mul(double scalar)
      Multiply vector with the scalar
    • sub

      public Vector3d sub(Vector3d vector)
      Multiply vector with the scalar
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

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

      public String toString()
      Overrides:
      toString in class Object