SFVec2f
The SFVec2f object corresponds to an X3D SFVec2f field.
Each component of the vector can be accessed using the x and y properties or using C-style array dereferencing (i.e., sfVec2fObjectName[0] or sfVec2fObjectName[1]).
Properties
Type | Property | Description | Standard |
---|---|---|---|
number | x | First value of the vector.
| X3D2.0 |
number | y | Second value of the vector.
| X3D2.0 |
Functions
Return type | Function | Description | Standard |
---|---|---|---|
SFVec2f(number x, number y) |
Constructs a new SFVec2f object initialized to the values of Missing values default to 0.0. | ||
SFVec2f | add(SFVec2f v) | Returns a new vector with the value of the passed value added, component-wise, to the object.
| X3D2.0 |
SFVec2f | divide(numeric n) | Returns a new vector with the value of the object divided by the passed value.
| X3D2.0 |
number | dot(SFVec2f v) | Returns the dot product of this vector and the passed value.
| X3D2.0 |
number | length() | Returns the geometric length of this vector.
| X3D2.0 |
SFVec2f | multiply(numeric n) | Returns a new vector with the value of the object multiplied by the passed value.
| X3D2.0 |
SFVec2f | normalize() | Returns a new vector with the value of object converted to unit length.
| X3D2.0 |
SFVec2f | subtract(SFVec2f v) | Returns a new vector with the value of the passed value subtracted, component-wise, from the object.
| X3D2.0 |
String | toString() | Returns a String containing the ISO/IEC xxxxx UTF-8 encoded value of x and y.
| X3D2.0 |