20 |
|
|
21 |
namespace usata |
namespace usata |
22 |
{ |
{ |
23 |
|
/*! \defgroup math Mathematics */ |
24 |
|
|
25 |
|
//! \brief Mathematical classes and functions |
26 |
namespace math |
namespace math |
27 |
{ |
{ |
28 |
|
|
29 |
|
//! \ingroup math |
30 |
//! \brief Homogeneous 3D vector |
//! \brief Homogeneous 3D vector |
31 |
|
//! \todo Convert to an expression template implementation. |
32 |
//! \param T Component type. |
//! \param T Component type. |
33 |
template <typename T> |
template <typename T> |
34 |
class Vector4 |
class Vector4 |
61 |
|
|
62 |
//! \brief Index operator |
//! \brief Index operator |
63 |
//! \param index Index of component. |
//! \param index Index of component. |
64 |
T |
//! \return reference to component. |
65 |
|
T& |
66 |
operator[] (int index) const |
operator[] (int index) const |
67 |
{ |
{ |
68 |
return v[index]; |
return v[index]; |
216 |
|
|
217 |
//! \brief Returns dot product |
//! \brief Returns dot product |
218 |
//! \param[in] rhs Right operand. |
//! \param[in] rhs Right operand. |
219 |
|
//! \return Dot product. |
220 |
T |
T |
221 |
dot(const Vector4& rhs) const |
dot(const Vector4& rhs) const |
222 |
{ |
{ |
228 |
|
|
229 |
//! \brief Returns cross product |
//! \brief Returns cross product |
230 |
//! \param[in] rhs Right operand. |
//! \param[in] rhs Right operand. |
231 |
|
//! \return Cross product. |
232 |
T |
T |
233 |
cross(const Vector4& rhs) const |
cross(const Vector4& rhs) const |
234 |
{ |
{ |
250 |
} |
} |
251 |
|
|
252 |
//! \brief Returns magnitude |
//! \brief Returns magnitude |
253 |
|
//! \return Magnitude. |
254 |
T |
T |
255 |
length() const |
length() const |
256 |
{ |
{ |