Class JxnVectorAlgebra

    • Constructor Detail

      • JxnVectorAlgebra

        public JxnVectorAlgebra​(double x,
                                double y,
                                double z)
        Creates a 3-dimensional vector ( x, y, z ).
      • JxnVectorAlgebra

        public JxnVectorAlgebra​(double lat,
                                double lon,
                                boolean degrees)
        Creates a 3-dimensional vector of length 1 from latitude-angle and longitude-angle.
        Parameters:
        degrees - if true, the angles are expected in degrees.
      • JxnVectorAlgebra

        protected JxnVectorAlgebra​(double[] arr)
        Creates a vector algebra instance from the array double [] arr. Calls JxnVectorAlgebra( arr, false )
      • JxnVectorAlgebra

        protected JxnVectorAlgebra​(double[] arr,
                                   boolean copyInput)
        Creates a vector algebra instance from the array double [] arr.
        Parameters:
        copyInput - if true, stores a copy of the array arr, otherwise stores a reference to the array arr.
      • JxnVectorAlgebra

        public JxnVectorAlgebra​(JxnVectorAlgebra v)
        Creates a copy of v.
    • Method Detail

      • cloneThis

        public JxnCloneableAlgebra cloneThis()
        Description copied from interface: JxnCloneableAlgebra
        Called internally. Required to avoid overwriting the left side operand opndLeft in opndLeft op opndRght, if op is implemented as opndLeft.op(opndRght) and the instance method op modifies the instance.
        Specified by:
        cloneThis in interface JxnCloneableAlgebra
        Returns:
        copy of this instance
      • mul

        public JxnVectorAlgebra mul​(double scalar)
        Multiplies this vector by scalar.
        Returns:
        this
      • mulL

        public JxnVectorAlgebra mulL​(double scalar)
        Multiplies this vector by scalar.
        Returns:
        this
      • div

        public JxnVectorAlgebra div​(double scalar)
        Divides this vector by scalar.
        Returns:
        this
      • equals

        public boolean equals​(Object other)
        Two vector objects are equal, if all corresponding components are equal. Use setEqualityTolerance(double) to set a tolerance for the comparision of the vector components.
        Overrides:
        equals in class Object
      • setEqualityTolerance

        public static double setEqualityTolerance​(double eps)
        Sets the tolerance for the equals method for all instances of this class.
        Parameters:
        eps -
          eps > 0. absolute difference
          eps < 0. difference relative to the length of the longest of two vectors to be compared
        Returns:
        old tolerance
      • getEqualityTolerance

        public static double getEqualityTolerance()
        Returns the tolerance used for the equals method.
      • toString

        public String toString()
        Returns a String representation of this vector object.
        Overrides:
        toString in class Object
      • toArray

        public double[] toArray()
        Returns an array containing the vector components of this vector object.
      • set

        public JxnVectorAlgebra set​(int i,
                                    double vi)
        Replaces the i-th component of this JxnVectorAlgebra by vi.
        Returns:
        this
      • setValue

        public double setValue​(int i,
                               double vi)
        Replaces the i-th component of this JxnVectorAlgebra by vi.
        Returns:
        the old value
      • get

        public double get​(int i)
        Returns the i-th component of this vector object.
      • getX

        public double getX()
        Returns the x-component of this vector object.
      • getY

        public double getY()
        Returns the y-component of this vector object.
      • getZ

        public double getZ()
        Returns the z-component of this vector object.
      • abs

        public double abs()
        Returns the length (sqrt of the sum of the squares of the components) of this vector object.
      • abs

        public static double abs​(JxnVectorAlgebra va)
        Returns the length (sqrt of the sum of the squares of the components) of va.
      • lat

        public double lat()
        Returns the latitude angle of this vector object.
      • latD

        public double latD()
        Returns the latitude angle of this vector object in degrees.
      • lat

        public static double lat​(JxnVectorAlgebra va)
        Returns the latitude angle of va.
      • latD

        public static double latD​(JxnVectorAlgebra va)
        Returns the latitude angle of va in degrees.
      • lon

        public double lon()
        Returns the longitude angle of this vector object.
      • lonD

        public double lonD()
        Returns the longitude angle of this vector object in degrees.
      • lon

        public static double lon​(JxnVectorAlgebra va)
        Returns the latitude angle of va.
      • lonD

        public static double lonD​(JxnVectorAlgebra va)
        Returns the latitude angle of va in degrees.
      • normal

        public static JxnVectorAlgebra normal​(JxnVectorAlgebra vr)
        Finds a normal vector for vr. Use vn1 = normal( vr ); vn2 = mul( vn1, vr ); to get an orthogonal system.