Module JNISpice
Package spice.basic

Class Vector3

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) double[] v  
    • Constructor Summary

      Constructors 
      Constructor Description
      Vector3()
      Construct a zero-filled Vector3.
      Vector3​(double[] vin)
      Construct a Vector3 from an array of 3 doubles.
      Vector3​(double v0, double v1, double v2)
      Construct a Vector3 from three double scalars.
      Vector3​(Vector3 vin)
      Copy constructor: create a new Vector3 from another.
    • Method Summary

      Modifier and Type Method Description
      Vector3 add​(Vector3 v2)
      Add two 3 dimensional vectors.
      void assign​(double[] values)
      Assign the contents of an array of three doubles to a Vector3.
      Vector3 cross​(Vector3 v2)
      Compute the cross product of two 3-dimensional vectors.
      double dist​(Vector3 v1)
      Return the distance between two three-dimensional vectors.
      double dot​(Vector3 v2)
      Compute the dot product of two double precision, 3-dimensional vectors.
      double getElt​(int i)
      Return the element of this instance at index [i].
      Vector3 hat()
      Find the unit vector along a double precision 3-dimensional vector.
      boolean isZero()
      Indicate whether a 3-vector is the zero vector.
      static Vector3 lcom​(double a, Vector3 v1, double b, Vector3 v2)
      Compute a vector linear combination of two double precision, 3-dimensional vectors.
      static Vector3 lcom​(double a, Vector3 v1, double b, Vector3 v2, double c, Vector3 v3)
      Compute a vector linear combination of three double precision, 3-dimensional vectors.
      Vector3 negate()
      Negate a double precision 3-dimensional vector.
      double norm()
      Compute the magnitude of a double precision, 3-dimensional vector.
      Vector3 perp​(Vector3 v2)
      Find the component of this vector orthogonal to a given vector.
      Vector3 proj​(Vector3 v2)
      Find the orthogonal projection of this vector onto a given vector.
      Vector3 rotate​(int axisIndex, double angle)
      Transform this vector into a basis that is rotated in the counterclockwise sense about a given coordinate axis by a given angle.Units are radians.
      Vector3 rotate​(Vector3 axisVector, double angle)
      Rotate this vector in the counterclockwise sense about a given vector by a given angle.Units are radians.
      Vector3 scale​(double s)
      Multiply a Vector3 by a scalar.
      double sep​(Vector3 v2)
      Find the separation angle in radians between two double precision, 3-dimensional vectors.This angle is defined as zero if either vector is zero.
      Vector3 sub​(Vector3 v2)
      Compute the difference between two 3-dimensional, double precision vectors.
      double[] toArray()
      Return the contents of a Vector3 in an array of 3 doubles.
      java.lang.String toString()
      Return a string representation of the contents of a Vector3.This overrides Object's toString method.
      Vector3 ucross​(Vector3 v2)
      Return the unitized cross product of this vector and a given vector.
      • Methods inherited from class java.lang.Object

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

      • v

        double[] v
    • Constructor Detail

      • Vector3

        public Vector3()
        Construct a zero-filled Vector3.
      • Vector3

        public Vector3​(Vector3 vin)
        Copy constructor: create a new Vector3 from another.
        Parameters:
        vin -
      • Vector3

        public Vector3​(double[] vin)
        Construct a Vector3 from an array of 3 doubles.
        Parameters:
        vin -
      • Vector3

        public Vector3​(double v0,
                       double v1,
                       double v2)
        Construct a Vector3 from three double scalars.
        Parameters:
        v0 -
        v2 -
        v1 -
    • Method Detail

      • assign

        public void assign​(double[] values)
                    throws SpiceException
        Assign the contents of an array of three doubles to a Vector3.
        Parameters:
        values - double[]
        Throws:
        SpiceException - exeption
      • add

        public Vector3 add​(Vector3 v2)
        Add two 3 dimensional vectors.
        Parameters:
        v2 - Vector3
        Returns:
        Vector3
      • cross

        public Vector3 cross​(Vector3 v2)
        Compute the cross product of two 3-dimensional vectors.
        Parameters:
        v2 - Vector3
        Returns:
        Vector3
      • dist

        public double dist​(Vector3 v1)
        Return the distance between two three-dimensional vectors.
        Parameters:
        v1 - Vector3
        Returns:
        double
      • dot

        public double dot​(Vector3 v2)
        Compute the dot product of two double precision, 3-dimensional vectors.
        Parameters:
        v2 - Vector3
        Returns:
        double
      • getElt

        public double getElt​(int i)
                      throws SpiceException
        Return the element of this instance at index [i].
        Parameters:
        i - int
        Returns:
        double
        Throws:
        SpiceException - exeption
      • hat

        public Vector3 hat()
        Find the unit vector along a double precision 3-dimensional vector.
        Returns:
        Vector3
      • isZero

        public boolean isZero()
        Indicate whether a 3-vector is the zero vector.
        Returns:
        boolean
      • lcom

        public static Vector3 lcom​(double a,
                                   Vector3 v1,
                                   double b,
                                   Vector3 v2)
        Compute a vector linear combination of two double precision, 3-dimensional vectors.
        Parameters:
        a - dobule
        v2 - Vector3
        v1 - Vector3
        b - double
        Returns:
        Vector3
      • lcom

        public static Vector3 lcom​(double a,
                                   Vector3 v1,
                                   double b,
                                   Vector3 v2,
                                   double c,
                                   Vector3 v3)
        Compute a vector linear combination of three double precision, 3-dimensional vectors.
        Parameters:
        a - double
        v3 - Vector3
        v1 - Vector3
        c - double
        b - double
        v2 - Vector3
        Returns:
        Vector3
      • negate

        public Vector3 negate()
        Negate a double precision 3-dimensional vector.
        Returns:
        Vector3
      • norm

        public double norm()
        Compute the magnitude of a double precision, 3-dimensional vector.
        Returns:
        double
      • rotate

        public Vector3 rotate​(int axisIndex,
                              double angle)
                       throws SpiceException
        Transform this vector into a basis that is rotated in the counterclockwise sense about a given coordinate axis by a given angle.Units are radians.

        Equivalently, this method rotates this vector by the negative of the input angle about the indicated axis.

        The coordinate axis is identified by an integer:

             1 == X axis
             2 == Y axis
             3 == Z axis
           
        Parameters:
        axisIndex - int
        angle - double
        Returns:
        Vector3
        Throws:
        SpiceException - exeption
      • rotate

        public Vector3 rotate​(Vector3 axisVector,
                              double angle)
                       throws SpiceException
        Rotate this vector in the counterclockwise sense about a given vector by a given angle.Units are radians.
        Parameters:
        axisVector - Vector3
        angle - double
        Returns:
        Vector3
        Throws:
        SpiceException - exeption
      • scale

        public Vector3 scale​(double s)
        Multiply a Vector3 by a scalar.
        Parameters:
        s - double
        Returns:
        Vector3
      • sub

        public Vector3 sub​(Vector3 v2)
        Compute the difference between two 3-dimensional, double precision vectors.
        Parameters:
        v2 - Vector3
        Returns:
        Vector3
      • sep

        public double sep​(Vector3 v2)
        Find the separation angle in radians between two double precision, 3-dimensional vectors.This angle is defined as zero if either vector is zero.
        Parameters:
        v2 - Vector3
        Returns:
        double
      • toArray

        public double[] toArray()
        Return the contents of a Vector3 in an array of 3 doubles.
        Returns:
        double[]
      • toString

        public java.lang.String toString()
        Return a string representation of the contents of a Vector3.This overrides Object's toString method.
        Overrides:
        toString in class java.lang.Object
        Returns:
        String
      • ucross

        public Vector3 ucross​(Vector3 v2)
                       throws SpiceException
        Return the unitized cross product of this vector and a given vector.

        Return the zero vector if the cross product is zero.

        Parameters:
        v2 - Vector3
        Returns:
        Vector3
        Throws:
        SpiceException - exeption