| Home | Download | Screen shots | Discussion | Documentation |
|---|
#include <openvrml/basetypes.h>
Public Member Functions | |
| vec2f () throw () | |
| Construct. | |
| vec2f (const float(&vec)[2]) throw () | |
| Construct from an array. | |
| vec2f (float x, float y) throw () | |
Construct from x and y components. | |
| vec2f & | operator *= (float scalar) throw () |
| Multiply by a scalar. | |
| vec2f & | operator/= (float scalar) throw () |
| Divide by a scalar. | |
| vec2f & | operator+= (const vec2f &vec) throw () |
| Add a vector. | |
| vec2f & | operator-= (const vec2f &vec) throw () |
| Subtract a vector. | |
| const vec2f | operator- () const throw () |
| Negate. | |
| const float & | operator[] (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 | dot (const vec2f &vec) const throw () |
| Dot product. | |
| float | length () const throw () |
| Geometric length. | |
| const vec2f | normalize () const throw () |
| Normalize. | |
Private Attributes | |
| float | vec [2] |
| Vector components. | |
Friends | |
| std::istream & | operator>> (std::istream &in, vec2f &v) |
| Stream input. | |
Related Functions | |
| (Note that these are not member functions.) | |
| const openvrml::vec2f | operator * (const vec2f &lhs, const float rhs) throw() |
| Multiply a vector by a scalar. | |
| const openvrml::vec2f | operator * (const float lhs, const vec2f &rhs) throw() |
| Multiply a vector by a scalar. | |
| const openvrml::vec2f | operator/ (const vec2f &lhs, const float rhs) throw() |
| Divide a vector by a scalar. | |
| const openvrml::vec2f | operator+ (const vec2f &lhs, const vec2f &rhs) throw() |
| Add two vectors. | |
| const openvrml::vec2f | operator- (const vec2f &lhs, const vec2f &rhs) throw() |
| Subtract two vectors. | |
| bool | operator== (const vec2f &lhs, const vec2f &rhs) throw() |
| Compare for equality. | |
| bool | operator!= (const vec2f &lhs, const vec2f &rhs) throw() |
| Compare for inequality. | |
| std::ostream & | operator<< (std::ostream &out, const vec2f &v) |
| Stream output. | |
| openvrml::vec2f::vec2f | ( | ) | throw () |
Construct.
| openvrml::vec2f::vec2f | ( | const float & | vec[2] | ) | throw () [explicit] |
Construct from an array.
vec are valid numeric values (i.e., not NaN).| [in] | vec | an array comprising the vector components. |
| openvrml::vec2f::vec2f | ( | float | x, | |
| float | y | |||
| ) | throw () |
Construct from x and y components.
x and y are valid numeric values (i.e., not NaN).| [in] | x | x component. |
| [in] | y | y component. |
| openvrml::vec2f & openvrml::vec2f::operator *= | ( | float | scalar | ) | throw () |
Multiply by a scalar.
| [in] | scalar | factor by which to multiply. |
| openvrml::vec2f & openvrml::vec2f::operator/= | ( | float | scalar | ) | throw () |
Divide by a scalar.
scalar is nonzero.| [in] | scalar | divisor. |
| openvrml::vec2f & openvrml::vec2f::operator+= | ( | const vec2f & | vec | ) | throw () |
Add a vector.
| [in] | vec | the vector to add. |
| openvrml::vec2f & openvrml::vec2f::operator-= | ( | const vec2f & | vec | ) | throw () |
Subtract a vector.
| [in] | vec | the vector to subtract. |
| const openvrml::vec2f openvrml::vec2f::operator- | ( | ) | const throw () |
Negate.
| const float & openvrml::vec2f::operator[] | ( | size_t | index | ) | const throw () [inline] |
Index-based component access.
| [in] | index | 0 corresponds to the x component; 1 corresponds to the y component. |
index.index is less than 2. | float openvrml::vec2f::x | ( | ) | const throw () [inline] |
Get the x component.
| void openvrml::vec2f::x | ( | float | value | ) | throw () [inline] |
Set the x component.
value is a valid numeric value (i.e., not NaN).| [in] | value | new x component value. |
| float openvrml::vec2f::y | ( | ) | const throw () [inline] |
Get the y component.
| void openvrml::vec2f::y | ( | float | value | ) | throw () [inline] |
Set the y component.
value is a valid numeric value (i.e., not NaN).| [in] | value | new y component value. |
| float openvrml::vec2f::dot | ( | const vec2f & | vec | ) | const throw () |
Dot product.
| [in] | vec |
vec. | float openvrml::vec2f::length | ( | ) | const throw () |
Geometric length.
| const openvrml::vec2f openvrml::vec2f::normalize | ( | ) | const throw () |
Normalize.
| std::istream& operator>> | ( | std::istream & | in, | |
| vec2f & | v | |||
| ) | [friend] |
Stream input.
Consistent with the VRML97 convention, commas (“,”) in the input are treated as whitespace.
| [in,out] | in | input stream. |
| [out] | v | a vec2f. |
in. | const openvrml::vec2f operator * | ( | const vec2f & | lhs, | |
| const float | rhs | |||
| ) | throw() [related] |
Multiply a vector by a scalar.
| [in] | lhs | left-hand operand (the vector). |
| [in] | rhs | right-hand operand (the scalar). |
| const openvrml::vec2f operator * | ( | const float | lhs, | |
| const vec2f & | rhs | |||
| ) | throw() [related] |
Multiply a vector by a scalar.
| [in] | lhs | left-hand operand (the scalar). |
| [in] | rhs | right-hand operand (the vector). |
| const openvrml::vec2f operator/ | ( | const vec2f & | lhs, | |
| const float | rhs | |||
| ) | throw() [related] |
Divide a vector by a scalar.
rhs is nonzero.| [in] | lhs | left-hand operand (the vector). |
| [in] | rhs | right-hand operand (the scalar). |
| const openvrml::vec2f operator+ | ( | const vec2f & | lhs, | |
| const vec2f & | rhs | |||
| ) | throw() [related] |
Add two vectors.
| [in] | lhs | left-hand operand. |
| [in] | rhs | right-hand operand. |
| const openvrml::vec2f operator- | ( | const vec2f & | lhs, | |
| const vec2f & | rhs | |||
| ) | throw() [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. | std::ostream & operator<< | ( | std::ostream & | out, | |
| const vec2f & | v | |||
| ) | [related] |
Stream output.
| [in,out] | out | output stream. |
| [in] | v | a 2-component vector. |
out.
float openvrml::vec2f::vec[2] [private] |
Vector components.
For internal use only.