Package com.openinventor.inventor
Class SbVec2d
java.lang.Object
com.openinventor.inventor.SbBasic
com.openinventor.inventor.SbVec2d
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 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
Equality comparison within given tolerance - the square of the length of the maximum distance between the two vectors.boolean
double[]
getValue()
double
getValueAt
(int index) double
getX()
double
getY()
double
length()
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
negate()
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
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)
-
Field Details
-
array
public final double[] array
-
-
Constructor Details
-
SbVec2d
public SbVec2d(double c0, double c1) -
SbVec2d
public SbVec2d(double[] components) -
SbVec2d
-
SbVec2d
public SbVec2d()
-
-
Method Details
-
setValue
-
getValueAt
public double getValueAt(int index) -
getValue
public double[] getValue() -
setValue
-
setValue
-
setValue
-
setValueAt
public void setValueAt(int index, double value) -
setX
public void setX(double value) -
setY
public void setY(double value) -
getX
public double getX() -
getY
public double getY() -
lengthSquared
public double lengthSquared()Returns square length of vector. Faster thanlength()
. -
negate
public void negate()Negates each component of vector in place. -
equals
Equality comparison within given tolerance - the square of the length of the maximum distance between the two vectors. -
toArray
-
normalize
public double normalize()Changes vector to be unit length. -
dot
Returns dot (inner) product of vector and another vector. -
length
public double length()Returns geometric length of vector. -
equals
-
substract
Component-wise vector subtraction operator. -
setValue
Sets value of vector from a single precision vector. -
divide
public void divide(double d) Component-wise scalar division operator. -
multiply
public void multiply(double d) Component-wise scalar multiplication operator. -
add
Component-wise vector addition operator. -
times
Component-wise binary scalar multiplication operator. -
plus
Component-wise binary vector addition operator. -
minus
Component-wise binary vector subtraction operator. -
over
Component-wise binary scalar division operator.
-