mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 05:26:45 +08:00
minor regularization of vectors and matrices
This commit is contained in:
@@ -14,9 +14,7 @@ namespace BlackMisc
|
||||
namespace Math
|
||||
{
|
||||
|
||||
class CMatrix3x3; // forward declaration
|
||||
class CMatrix3x1; // forward declaration
|
||||
|
||||
class CMatrix3x1;
|
||||
|
||||
/*!
|
||||
* \brief 3D vector base (x, y, z)
|
||||
@@ -101,6 +99,13 @@ protected:
|
||||
*/
|
||||
CVector3DBase(const CVector3DBase &other) : m_i(other.m_i), m_j(other.m_j), m_k(other.m_k) {}
|
||||
|
||||
/*!
|
||||
* \brief Get element
|
||||
* \param row
|
||||
* \return Mutable reference
|
||||
*/
|
||||
double &getElement(size_t row);
|
||||
|
||||
/*!
|
||||
* \brief String for converter
|
||||
* \param i18n
|
||||
@@ -155,7 +160,8 @@ public:
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Set zeros
|
||||
* \brief Set all elements the same
|
||||
* \param value
|
||||
*/
|
||||
void fill(double value);
|
||||
|
||||
@@ -180,6 +186,13 @@ public:
|
||||
*/
|
||||
double operator[](size_t row) const { return this->getElement(row); }
|
||||
|
||||
/*!
|
||||
* \brief Operator []
|
||||
* \param row
|
||||
* \return Mutable reference
|
||||
*/
|
||||
double &operator[](size_t row) { return this->getElement(row); }
|
||||
|
||||
/*!
|
||||
* \brief Equal operator ==
|
||||
* \param other
|
||||
@@ -253,31 +266,6 @@ public:
|
||||
return v;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Operator *=, just x*x, y*y, z*z neither vector nor dot product (like a matrix produc)
|
||||
* \param other
|
||||
* \return
|
||||
*/
|
||||
CVector3DBase &operator *=(const CVector3DBase &other)
|
||||
{
|
||||
this->m_i *= other.m_i;
|
||||
this->m_j *= other.m_j;
|
||||
this->m_k *= other.m_k;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Operator, just x*x, y*y, z*z neither vector nor dot product, (like a matrix produc)
|
||||
* \param other
|
||||
* \return
|
||||
*/
|
||||
ImplVector operator *(const ImplVector &other) const
|
||||
{
|
||||
ImplVector v = *derived();
|
||||
v *= other;
|
||||
return v;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Multiply with scalar
|
||||
* \param factor
|
||||
@@ -339,31 +327,6 @@ public:
|
||||
return v;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Operator /=, just x/x, y/y, z/z
|
||||
* \param other
|
||||
* \return
|
||||
*/
|
||||
CVector3DBase &operator /=(const CVector3DBase &other)
|
||||
{
|
||||
this->m_i /= other.m_i;
|
||||
this->m_j /= other.m_j;
|
||||
this->m_k /= other.m_k;
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Operator, just x/x, y/y, z/z
|
||||
* \param other
|
||||
* \return
|
||||
*/
|
||||
ImplVector operator /(const ImplVector &other) const
|
||||
{
|
||||
ImplVector v = *derived();
|
||||
v /= other;
|
||||
return v;
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Dot product
|
||||
* \param other
|
||||
@@ -378,13 +341,6 @@ public:
|
||||
*/
|
||||
ImplVector crossProduct(const ImplVector &other) const;
|
||||
|
||||
/*!
|
||||
* \brief Matrix * this vector
|
||||
* \param matrix
|
||||
* \return
|
||||
*/
|
||||
void matrixMultiplication(const CMatrix3x3 &matrix);
|
||||
|
||||
/*!
|
||||
* \brief Reciprocal value
|
||||
* \return
|
||||
|
||||
Reference in New Issue
Block a user