Browse Source

Doc++

pull/7/head
Vladimír Vondruš 14 years ago
parent
commit
1eef70b184
  1. 4
      src/Math/Quaternion.h
  2. 36
      src/Math/Vector.h

4
src/Math/Quaternion.h

@ -117,10 +117,10 @@ template<class T> class Quaternion {
} }
/** @brief Default constructor */ /** @brief Default constructor */
inline constexpr Quaternion(): _scalar(T(1)) {} inline constexpr /*implicit*/ Quaternion(): _scalar(T(1)) {}
/** @brief Create quaternion from vector and scalar */ /** @brief Create quaternion from vector and scalar */
inline constexpr Quaternion(const Vector3<T>& vector, T scalar): _vector(vector), _scalar(scalar) {} inline constexpr /*implicit*/ Quaternion(const Vector3<T>& vector, T scalar): _vector(vector), _scalar(scalar) {}
/** @brief Equality comparison */ /** @brief Equality comparison */
inline bool operator==(const Quaternion<T>& other) const { inline bool operator==(const Quaternion<T>& other) const {

36
src/Math/Vector.h

@ -151,20 +151,12 @@ template<std::size_t size, class T> class Vector: public RectangularMatrix<1, si
return true; return true;
} }
/**
* @brief Multiply vector component-wise
*
* @see operator*=(const Vector<size, U>&)
*/
template<class U> inline Vector<size, T> operator*(const Vector<size, U>& other) const {
return Vector<size, T>(*this)*=other;
}
/** /**
* @brief Multiply vector component-wise and assign * @brief Multiply vector component-wise and assign
* *
* More efficient than operator*(const Vector<size, U>&) const, * The computation is done in-place. @f[
* because it does the computation in-place. * \boldsymbol a_i = \boldsymbol a_i \boldsymbol b_i
* @f]
*/ */
template<class U> Vector<size, T>& operator*=(const Vector<size, U>& other) { template<class U> Vector<size, T>& operator*=(const Vector<size, U>& other) {
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
@ -174,19 +166,20 @@ template<std::size_t size, class T> class Vector: public RectangularMatrix<1, si
} }
/** /**
* @brief Divide vector component-wise * @brief Multiply vector component-wise
* *
* @see operator/=(const Vector<size, U>&) * @see operator*=(const Vector<size, U>&)
*/ */
template<class U> inline Vector<size, T> operator/(const Vector<size, U>& other) const { template<class U> inline Vector<size, T> operator*(const Vector<size, U>& other) const {
return Vector<size, T>(*this)/=other; return Vector<size, T>(*this)*=other;
} }
/** /**
* @brief Divide vector component-wise and assign * @brief Divide vector component-wise and assign
* *
* More efficient than operator/(const Vector<size, U>&) const, * The computation is done in-place. @f[
* because it does the computation in-place. * \boldsymbol a_i = \frac{\boldsymbol a_i}{\boldsymbol b_i}
* @f]
*/ */
template<class U> Vector<size, T>& operator/=(const Vector<size, U>& other) { template<class U> Vector<size, T>& operator/=(const Vector<size, U>& other) {
for(std::size_t i = 0; i != size; ++i) for(std::size_t i = 0; i != size; ++i)
@ -195,6 +188,15 @@ template<std::size_t size, class T> class Vector: public RectangularMatrix<1, si
return *this; return *this;
} }
/**
* @brief Divide vector component-wise
*
* @see operator/=(const Vector<size, U>&)
*/
template<class U> inline Vector<size, T> operator/(const Vector<size, U>& other) const {
return Vector<size, T>(*this)/=other;
}
/** /**
* @brief Dot product of the vector * @brief Dot product of the vector
* *

Loading…
Cancel
Save