Package com.openinventor.inventor
Class SbVec2f
- java.lang.Object
-
- com.openinventor.inventor.SbBasic
-
- com.openinventor.inventor.SbVec2f
-
public class SbVec2f extends SbBasic
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.
-
-
Field Summary
Fields Modifier and Type Field Description float[]
array
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(SbVec2f u)
Component-wise vector addition operator.void
divide(float d)
Component-wise scalar division operator.float
dot(SbVec2f v)
Returns dot (inner) product of vector and another vector.boolean
equals(SbVec2f v, float tolerance)
Equality comparison within given tolerance - the square of the length of the maximum distance between the two vectors.boolean
equals(java.lang.Object obj)
float[]
getValue()
float
getValueAt(int index)
float
getX()
float
getY()
float
length()
Returns geometric length of vector.float
lengthSquared()
Returns square length of vector.SbVec2f
minus(SbVec2f v2)
Component-wise binary vector subtraction operator.void
multiply(float d)
Component-wise scalar multiplication operator.void
multiply(SbVec2f v)
Component-wise vector multiplication operator.void
negate()
Negates each component of vector in place.float
normalize()
Changes vector to be unit length.SbVec2f
over(float d)
Component-wise binary scalar division operator.SbVec2f
plus(SbVec2f v2)
Component-wise binary vector addition operator.SbVec2f
setValue(float[] components)
SbVec2f
setValue(float[] components, int startIndex)
SbVec2f
setValue(float c0, float c1)
SbVec2f
setValue(SbVec2d vec2d)
Sets value of vector from a double precision vector.void
setValue(SbVec2f copyFrom)
void
setValueAt(int index, float value)
void
setX(float value)
void
setY(float value)
void
substract(SbVec2f u)
Component-wise vector subtraction operator.SbVec2f
times(float d)
Component-wise binary scalar multiplication operator.SbVec2f
times(SbVec2f v)
Component-wise vector multiplication operator.static SbVec2f[]
toArray(long nativeArray, long length)
-
-
-
Constructor Detail
-
SbVec2f
public SbVec2f()
-
SbVec2f
public SbVec2f(float c0, float c1)
-
SbVec2f
public SbVec2f(float[] components)
-
SbVec2f
public SbVec2f(SbVec2f copyFrom)
-
SbVec2f
public SbVec2f(float val)
Constructor that sets all components to the same value.
-
-
Method Detail
-
setX
public void setX(float value)
-
setValue
public void setValue(SbVec2f copyFrom)
-
setValue
public SbVec2f setValue(float c0, float c1)
-
setValueAt
public void setValueAt(int index, float value)
-
getValue
public float[] getValue()
-
setValue
public SbVec2f setValue(float[] components, int startIndex)
-
getValueAt
public float getValueAt(int index)
-
setValue
public SbVec2f setValue(float[] components)
-
getY
public float getY()
-
setY
public void setY(float value)
-
getX
public float getX()
-
over
public SbVec2f over(float d)
Component-wise binary scalar division operator.
-
toArray
public static SbVec2f[] toArray(long nativeArray, long length)
-
equals
public boolean equals(SbVec2f v, float tolerance)
Equality comparison within given tolerance - the square of the length of the maximum distance between the two vectors.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
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
public float dot(SbVec2f v)
Returns dot (inner) product of vector and another vector.
-
divide
public void divide(float d)
Component-wise scalar division operator.
-
multiply
public void multiply(SbVec2f v)
Component-wise vector multiplication operator.
-
add
public void add(SbVec2f u)
Component-wise vector addition operator.
-
times
public SbVec2f times(float d)
Component-wise binary scalar multiplication operator.
-
substract
public void substract(SbVec2f u)
Component-wise vector subtraction operator.
-
setValue
public SbVec2f setValue(SbVec2d vec2d)
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.
-
multiply
public void multiply(float d)
Component-wise scalar multiplication operator.
-
-