Home | Download | Screen shots | Discussion | Documentation |
---|
Three-component single-precision vector. More...
#include <openvrml/basetypes.h>
Public Member Functions | |
vec3f & | operator*= (const vec3f &vec) throw () |
Cross multiply. | |
vec3f & | operator*= (const mat4f &mat) throw () |
Multiply by a matrix. | |
vec3f & | operator*= (float scalar) throw () |
Multiply by a scalar. | |
vec3f & | operator/= (float scalar) throw () |
Divide by a scalar. | |
vec3f & | operator+= (const vec3f &vec) throw () |
Add a vector. | |
vec3f & | operator-= (const vec3f &vec) throw () |
Subtract a vector. | |
const vec3f | operator- () const throw () |
Negate. | |
const float & | operator[] (std::size_t index) const throw () |
Index-based component access. | |
float | x () const throw () |
Get the x component. | |
void | x (float value) throw () |
Set the x component. | |
float | y () const throw () |
Get the y component. | |
void | y (float value) throw () |
Set the y component. | |
float | z () const throw () |
Get the z component. | |
void | z (float value) throw () |
Set the z component. | |
float | dot (const vec3f &vec) const throw () |
Dot product. | |
float | length () const throw () |
Geometric length. | |
const vec3f | normalize () const throw () |
Normalize. |
Public Attributes | |
float | vec [3] |
Vector components. |
Related Functions | |
(Note that these are not member functions.) | |
const openvrml::vec3f | make_vec3f () throw() |
Create a vec3f . | |
const openvrml::vec3f | make_vec3f (const float(&vec)[3]) throw() |
Create a vec3f from an array. | |
const openvrml::vec3f | make_vec3f (const float x, const float y, const float z) throw() |
Create a vec3f from x , y , and z components. | |
const openvrml::vec3f | operator* (const vec3f &lhs, const vec3f &rhs) throw() |
Cross multiply two vectors. | |
const openvrml::vec3f | operator* (const vec3f &vec, const mat4f &mat) throw() |
Multiply a vector by a matrix. | |
const openvrml::vec3f | operator* (const mat4f &mat, const vec3f &vec) throw() |
Multiply a matrix by a vector. | |
const openvrml::vec3f | operator* (const vec3f &lhs, const float rhs) throw() |
Multiply a vector by a scalar. | |
const openvrml::vec3f | operator* (const float lhs, const vec3f &rhs) throw() |
Multiply a vector by a scalar. | |
const openvrml::vec3f | operator/ (const vec3f &lhs, const float rhs) throw() |
Divide a vector by a scalar. | |
const openvrml::vec3f | operator+ (const vec3f &lhs, const vec3f &rhs) throw() |
Add two vectors. | |
const openvrml::vec3f | operator- (const vec3f &lhs, const vec3f &rhs) throw() |
Subtract two vectors. | |
bool | operator== (const vec3f &lhs, const vec3f &rhs) throw() |
Compare for equality. | |
bool | operator!= (const vec3f &lhs, const vec3f &rhs) throw() |
Compare for inequality. | |
std::istream & | operator>> (std::istream &in, vec3f &v) |
Stream input. | |
std::ostream & | operator<< (std::ostream &out, const vec3f &v) |
Stream output. |
Three-component single-precision vector.
openvrml::vec3f & openvrml::vec3f::operator*= | ( | const vec3f & | vec | ) | throw () |
Cross multiply.
[in] | vec | vector by which to multiply. |
openvrml::vec3f & openvrml::vec3f::operator*= | ( | const mat4f & | mat | ) | throw () |
Multiply by a matrix.
[in] | mat | matrix by which to multiply. |
openvrml::vec3f & openvrml::vec3f::operator*= | ( | float | scalar | ) | throw () |
Multiply by a scalar.
[in] | scalar | factor by which to multiply. |
openvrml::vec3f & openvrml::vec3f::operator/= | ( | float | scalar | ) | throw () |
Divide by a scalar.
scalar
is nonzero.[in] | scalar | divisor. |
openvrml::vec3f & openvrml::vec3f::operator+= | ( | const vec3f & | vec | ) | throw () |
Add a vector.
[in] | vec | the vector to add. |
openvrml::vec3f & openvrml::vec3f::operator-= | ( | const vec3f & | vec | ) | throw () |
Subtract a vector.
[in] | vec | the vector to subtract. |
const openvrml::vec3f openvrml::vec3f::operator- | ( | ) | const throw () |
Negate.
|
inline |
Index-based component access.
[in] | index | 0 corresponds to the x component; 1 corresponds to the y component; 2 corresponds to the z component. |
index
.index
is less than 3.
|
inline |
Get the x component.
|
inline |
Set the x component.
value
is a valid numeric value (i.e., not NaN).[in] | value | new x component value. |
|
inline |
Get the y component.
|
inline |
Set the y component.
value
is a valid numeric value (i.e., not NaN).[in] | value | new y component value. |
|
inline |
Get the z component.
|
inline |
Set the z component.
value
is a valid numeric value (i.e., not NaN).[in] | value | new z component value. |
float openvrml::vec3f::dot | ( | const vec3f & | vec | ) | const throw () |
Dot product.
[in] | vec |
vec
. float openvrml::vec3f::length | ( | ) | const throw () |
Geometric length.
const openvrml::vec3f openvrml::vec3f::normalize | ( | ) | const throw () |
Normalize.
|
related |
|
related |
Create a vec3f
from an array.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
vec
are valid numeric values (i.e., not NaN).[in] | vec | an array comprising the vector components. |
vec3f
with the values in vec
.
|
related |
Create a vec3f
from x
, y
, and z
components.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
x
, y
and z
are valid numeric values (i.e., not NaN).[in] | x | x component. |
[in] | y | y component. |
[in] | z | z component. |
vec3f
with the values x
, y
, and z
.
|
related |
Cross multiply two vectors.
[in] | lhs | left-hand operand. |
[in] | rhs | right-hand operand. |
|
related |
Multiply a vector by a matrix.
[in] | vec | a vector. |
[in] | mat | a matrix. |
|
related |
Multiply a matrix by a vector.
[in] | mat | a matrix. |
[in] | vec | a 3-component vector. |
|
related |
Multiply a vector by a scalar.
[in] | lhs | left-hand operand (the vector). |
[in] | rhs | right-hand operand (the scalar). |
|
related |
Multiply a vector by a scalar.
[in] | lhs | left-hand operand (the scalar). |
[in] | rhs | right-hand operand (the vector). |
|
related |
Divide a vector by a scalar.
rhs
is nonzero.[in] | lhs | left-hand operand (the vector). |
[in] | rhs | right-hand operand (the scalar). |
|
related |
Add two vectors.
[in] | lhs | left-hand operand. |
[in] | rhs | right-hand operand. |
|
related |
Subtract two vectors.
[in] | lhs | left-hand operand. |
[in] | rhs | right-hand operand. |
Compare for equality.
[in] | lhs | left-hand operand. |
[in] | rhs | right-hand operand. |
true
if lhs
and rhs
have the same value; false
otherwise. Compare for inequality.
[in] | lhs | left-hand operand. |
[in] | rhs | right-hand operand. |
true
if lhs
and rhs
dot not have the same value; false
otherwise.
|
related |
Stream input.
Consistent with the VRML97 convention, commas (“,”) in the input are treated as whitespace.
[in,out] | in | input stream. |
[out] | v | a vec3f . |
in
.
|
related |
Stream output.
[in,out] | out | output stream. |
[in] | v | a 3-component vector. |
out
. float openvrml::vec3f::vec[3] |
Vector components.