Package com.openinventor.inventor
Class SbVec2f
java.lang.Object
com.openinventor.inventor.SbBasic
com.openinventor.inventor.SbVec2f
2D vector class.
2D vector class used to store 2D vectors and points. This class is used throughout Open Inventor for arguments and return values.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Component-wise vector addition operator.void
divide
(float d) Component-wise scalar division operator.float
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
float[]
getValue()
float
getValueAt
(int index) float
getX()
float
getY()
float
length()
Returns geometric length of vector.float
Returns square length of vector.Component-wise binary vector subtraction operator.void
multiply
(float d) Component-wise scalar multiplication operator.void
Component-wise vector multiplication operator.void
negate()
Negates each component of vector in place.float
Changes vector to be unit length.over
(float d) Component-wise binary scalar division operator.Component-wise binary vector addition operator.setValue
(float[] components) setValue
(float[] components, int startIndex) setValue
(float c0, float c1) Sets value of vector from a double precision vector.void
void
setValueAt
(int index, float value) void
setX
(float value) void
setY
(float value) void
Component-wise vector subtraction operator.times
(float d) Component-wise binary scalar multiplication operator.Component-wise vector multiplication operator.static SbVec2f[]
toArray
(long nativeArray, long length)
-
Field Details
-
array
public final float[] array
-
-
Constructor Details
-
SbVec2f
public SbVec2f() -
SbVec2f
public SbVec2f(float c0, float c1) -
SbVec2f
public SbVec2f(float[] components) -
SbVec2f
-
SbVec2f
public SbVec2f(float val) Constructor that sets all components to the same value.
-
-
Method Details
-
setX
public void setX(float value) -
setValue
-
setValue
-
setValueAt
public void setValueAt(int index, float value) -
getValue
public float[] getValue() -
setValue
-
getValueAt
public float getValueAt(int index) -
setValue
-
getY
public float getY() -
setY
public void setY(float value) -
getX
public float getX() -
over
Component-wise binary scalar division operator. -
toArray
-
minus
Component-wise binary vector subtraction operator. -
equals
Equality comparison within given tolerance - the square of the length of the maximum distance between the two vectors. -
equals
-
plus
Component-wise binary vector addition operator. -
lengthSquared
public float lengthSquared()Returns square length of vector. Faster thanlength()
. -
length
public float length()Returns geometric length of vector. -
normalize
public float normalize()Changes vector to be unit length. -
negate
public void negate()Negates each component of vector in place. -
dot
Returns dot (inner) product of vector and another vector. -
divide
public void divide(float d) Component-wise scalar division operator. -
multiply
Component-wise vector multiplication operator. -
add
Component-wise vector addition operator. -
times
Component-wise binary scalar multiplication operator. -
substract
Component-wise vector subtraction operator. -
setValue
Sets value of vector from a double precision vector. If the values stored in the double precision argument(s) are too large to be stored in single precision variables, some loss of data will occur during the data transfer. The loss of data is defined by the standard C type conversion from double to float. It is the application's responsibility to handle this potential loss of data appropriately.NOTE: Open Inventor fields still store only single precision values, not double precision values.
-
times
Component-wise vector multiplication operator. -
multiply
public void multiply(float d) Component-wise scalar multiplication operator.
-