Class SbVec2d

java.lang.Object
com.openinventor.inventor.SbBasic
com.openinventor.inventor.SbVec2d

public class SbVec2d extends SbBasic
2D vector class (double precision). 2D vector class used to store 2D vectors and points using double precision values. Although Open Inventor fields still store only single precision values, for certain applications it is useful and convenient to be able to store and manipulate double precision values, for example, double precision coordinate data or values that will be used for further computation.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final double[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    SbVec2d(double[] components)
     
    SbVec2d(double c0, double c1)
     
    SbVec2d(SbVec2d copyFrom)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Component-wise vector addition operator.
    void
    divide(double d)
    Component-wise scalar division operator.
    double
    Returns dot (inner) product of vector and another vector.
    boolean
    equals(SbVec2d v, double tolerance)
    Equality comparison within given tolerance - the square of the length of the maximum distance between the two vectors.
    boolean
     
    double[]
     
    double
    getValueAt(int index)
     
    double
     
    double
     
    double
    Returns geometric length of vector.
    double
    Returns square length of vector.
    Component-wise binary vector subtraction operator.
    void
    multiply(double d)
    Component-wise scalar multiplication operator.
    void
    Negates each component of vector in place.
    double
    Changes vector to be unit length.
    over(double d)
    Component-wise binary scalar division operator.
    Component-wise binary vector addition operator.
    setValue(double[] components)
     
    setValue(double[] components, int startIndex)
     
    setValue(double c0, double c1)
     
    void
    setValue(SbVec2d copyFrom)
     
    Sets value of vector from a single precision vector.
    void
    setValueAt(int index, double value)
     
    void
    setX(double value)
     
    void
    setY(double value)
     
    void
    Component-wise vector subtraction operator.
    times(double d)
    Component-wise binary scalar multiplication operator.
    static SbVec2d[]
    toArray(long nativeArray, long length)
     

    Methods inherited from class java.lang.Object

    getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • array

      public final double[] array
  • Constructor Details

    • SbVec2d

      public SbVec2d(double[] components)
    • SbVec2d

      public SbVec2d(SbVec2d copyFrom)
    • SbVec2d

      public SbVec2d(double c0, double c1)
    • SbVec2d

      public SbVec2d()
  • Method Details

    • getValueAt

      public double getValueAt(int index)
    • setValue

      public void setValue(SbVec2d copyFrom)
    • getValue

      public double[] getValue()
    • setValue

      public SbVec2d setValue(double[] components)
    • setValue

      public SbVec2d setValue(double[] components, int startIndex)
    • setValueAt

      public void setValueAt(int index, double value)
    • setValue

      public SbVec2d setValue(double c0, double c1)
    • setX

      public void setX(double value)
    • getY

      public double getY()
    • getX

      public double getX()
    • setY

      public void setY(double value)
    • divide

      public void divide(double d)
      Component-wise scalar division operator.
    • negate

      public void negate()
      Negates each component of vector in place.
    • equals

      public boolean equals(SbVec2d v, double tolerance)
      Equality comparison within given tolerance - the square of the length of the maximum distance between the two vectors.
    • lengthSquared

      public double lengthSquared()
      Returns square length of vector. Faster than length().
    • dot

      public double dot(SbVec2d v)
      Returns dot (inner) product of vector and another vector.
    • toArray

      public static SbVec2d[] toArray(long nativeArray, long length)
    • length

      public double length()
      Returns geometric length of vector.
    • add

      public void add(SbVec2d u)
      Component-wise vector addition operator.
    • multiply

      public void multiply(double d)
      Component-wise scalar multiplication operator.
    • substract

      public void substract(SbVec2d u)
      Component-wise vector subtraction operator.
    • setValue

      public SbVec2d setValue(SbVec2f vec2f)
      Sets value of vector from a single precision vector.
    • times

      public SbVec2d times(double d)
      Component-wise binary scalar multiplication operator.
    • equals

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

      public SbVec2d minus(SbVec2d v2)
      Component-wise binary vector subtraction operator.
    • plus

      public SbVec2d plus(SbVec2d v2)
      Component-wise binary vector addition operator.
    • over

      public SbVec2d over(double d)
      Component-wise binary scalar division operator.
    • normalize

      public double normalize()
      Changes vector to be unit length.