Main Page Modules Namespace List Class Hierarchy Compound List Namespace Members Compound Members Related Pages
openvrml::vec2f Class Reference
[Base Types]
Two-component single precision vector.
More...
List of all members.
|
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 & | operator[] (size_t index) throw () |
| Index-based component access.
|
float | x () const throw () |
| Get the x component.
|
float | y () const throw () |
| Get the y component.
|
void | x (float value) throw () |
| Set the x 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.
|
Related Functions |
(Note that these are not member functions.)
|
const vec2f | operator * (const vec2f &lhs, float rhs) throw() |
| Multiply a vector by a scalar.
|
const vec2f | operator/ (const vec2f &lhs, float rhs) throw() |
| Divide a vector by a scalar.
|
const vec2f | operator+ (const vec2f &lhs, const vec2f &rhs) throw() |
| Add two vectors.
|
const 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.
|
Detailed Description
Two-component single precision vector.
Constructor & Destructor Documentation
openvrml::vec2f::vec2f |
( |
|
) |
throw () [inline] |
|
openvrml::vec2f::vec2f |
( |
const float & |
vec[2] |
) |
throw () [inline, explicit] |
|
|
Construct from an array.
- Parameters:
-
vec | an array comprising the vector components. |
|
openvrml::vec2f::vec2f |
( |
float |
x, |
|
|
float |
y |
|
) |
throw () [inline] |
|
|
Construct from x and y components.
- Parameters:
-
x | x component. |
y | y component. |
|
Member Function Documentation
float openvrml::vec2f::dot |
( |
const vec2f & |
vec |
) |
const throw () [inline] |
|
|
Dot product.
- Parameters:
-
- Returns:
- the dot product of the vector and
vec .
|
float openvrml::vec2f::length |
( |
|
) |
const throw () [inline] |
|
|
Geometric length.
- Returns:
- the length of the vector.
|
const vec2f openvrml::vec2f::normalize |
( |
|
) |
const throw () |
|
|
Normalize.
- Returns:
- a vec2f that is the vector normalized.
|
vec2f & openvrml::vec2f::operator *= |
( |
float |
scalar |
) |
throw () [inline] |
|
|
Multiply by a scalar.
- Parameters:
-
scalar | factor by which to multiply. |
- Returns:
- a reference to the object.
|
vec2f & openvrml::vec2f::operator+= |
( |
const vec2f & |
vec |
) |
throw () [inline] |
|
|
Add a vector.
- Parameters:
-
- Returns:
- a reference to the object.
|
const vec2f openvrml::vec2f::operator- |
( |
|
) |
const throw () [inline] |
|
|
Negate.
- Returns:
- the additive inverse of the vector.
|
vec2f & openvrml::vec2f::operator-= |
( |
const vec2f & |
vec |
) |
throw () [inline] |
|
|
Subtract a vector.
- Parameters:
-
vec | the vector to subtract. |
- Returns:
- a reference to the object.
|
vec2f & openvrml::vec2f::operator/= |
( |
float |
scalar |
) |
throw () [inline] |
|
|
Divide by a scalar.
- Parameters:
-
scalar | factor by which to multiply. |
- Returns:
- a reference to the object.
|
float & openvrml::vec2f::operator[] |
( |
size_t |
index |
) |
throw () [inline] |
|
|
Index-based component access.
- Parameters:
-
index | 0 corresponds to the x component; 1 corresponds to the y component. |
- Returns:
- a reference to the component corresponding to
index .
- Precondition:
index is less than 2.
|
const float & openvrml::vec2f::operator[] |
( |
size_t |
index |
) |
const throw () [inline] |
|
|
Index-based component access.
- Parameters:
-
index | 0 corresponds to the x component; 1 corresponds to the y component. |
- Returns:
- a const reference to the component corresponding to
index .
- Precondition:
index is less than 2.
|
void openvrml::vec2f::x |
( |
float |
value |
) |
throw () [inline] |
|
|
Set the x component.
- Parameters:
-
value | new x component value. |
|
float openvrml::vec2f::x |
( |
|
) |
const throw () [inline] |
|
|
Get the x component.
- Returns:
- the x component.
|
void openvrml::vec2f::y |
( |
float |
value |
) |
throw () [inline] |
|
|
Set the y component.
- Parameters:
-
value | new y component value. |
|
float openvrml::vec2f::y |
( |
|
) |
const throw () [inline] |
|
|
Get the y component.
- Returns:
- the y component.
|
Friends And Related Function Documentation
const vec3f operator * |
( |
const vec2f & |
lhs, |
|
|
float |
rhs |
|
) |
throw() [related] |
|
|
Multiply a vector by a scalar.
- Parameters:
-
lhs | left-hand operand (the vector). |
rhs | right-hand operand (the scalar). |
- Returns:
- the result vector.
|
bool operator!= |
( |
const vec2f & |
lhs, |
|
|
const vec2f & |
rhs |
|
) |
throw() [related] |
|
|
Compare for inequality.
- Parameters:
-
lhs | left-hand operand. |
rhs | right-hand operand. |
- Returns:
true if lhs and rhs dot not have the same value; false otherwise.
|
const vec2f operator+ |
( |
const vec2f & |
lhs, |
|
|
const vec2f & |
rhs |
|
) |
throw() [related] |
|
|
Add two vectors.
- Parameters:
-
lhs | left-hand operand. |
rhs | right-hand operand. |
- Returns:
- the result vector.
|
const vec2f operator- |
( |
const vec2f & |
lhs, |
|
|
const vec2f & |
rhs |
|
) |
throw() [related] |
|
|
Subtract two vectors.
- Parameters:
-
lhs | left-hand operand. |
rhs | right-hand operand. |
- Returns:
- the result vector.
|
const vec2f operator/ |
( |
const vec2f & |
lhs, |
|
|
float |
rhs |
|
) |
throw() [related] |
|
|
Divide a vector by a scalar.
- Parameters:
-
lhs | left-hand operand (the vector). |
rhs | right-hand operand (the scalar). |
- Returns:
- the result vector.
|
std::ostream & operator<< |
( |
std::ostream & |
out, |
|
|
const vec2f & |
v |
|
) |
[related] |
|
|
Stream output.
- Parameters:
-
out | output stream. |
v | a 2-component vector. |
- Returns:
out .
|
bool operator== |
( |
const vec2f & |
lhs, |
|
|
const vec2f & |
rhs |
|
) |
throw() [related] |
|
|
Compare for equality.
- Parameters:
-
lhs | left-hand operand. |
rhs | right-hand operand. |
- Returns:
true if lhs and rhs have the same value; false otherwise.
|
Member Data Documentation
float openvrml::vec2f::vec[2] [private]
|
|
|
Vector components.
For internal use only.
|