Fix code formatting & grammar mistakes
This commit is contained in:
@@ -511,75 +511,6 @@ public:
|
|||||||
* @brief Rotation the matrix by an "angle". Works only with 2x2 matrix,
|
* @brief Rotation the matrix by an "angle". Works only with 2x2 matrix,
|
||||||
* else return default construction of PIMathMatrixT
|
* else return default construction of PIMathMatrixT
|
||||||
*
|
*
|
||||||
* @param angle is the angle of rotation of the matrix
|
|
||||||
* @return rotated matrix
|
|
||||||
*/
|
|
||||||
static _CMatrix rotation(double angle) {return _CMatrix();}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Rotation of the matrix by an "angle" along the X axis. Works only with 3x3 matrix,
|
|
||||||
* else return default construction of PIMathMatrixT
|
|
||||||
*
|
|
||||||
* @param angle is the angle of rotation of the matrix along the X axis
|
|
||||||
* @return rotated matrix
|
|
||||||
*/
|
|
||||||
static _CMatrix rotationX(double angle) {return _CMatrix();}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Rotation of the matrix by an "angle" along the Y axis. Works only with 3x3 matrix,
|
|
||||||
* else return default construction of PIMathMatrixT
|
|
||||||
*
|
|
||||||
* @param angle is the angle of rotation of the matrix along the Y axis
|
|
||||||
* @return rotated matrix
|
|
||||||
*/
|
|
||||||
static _CMatrix rotationY(double angle) {return _CMatrix();}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Rotation of the matrix by an "angle" along the Z axis. Works only with 3x3 matrix,
|
|
||||||
* else return default construction of PIMathMatrixT
|
|
||||||
*
|
|
||||||
* @param angle is the angle of rotation of the matrix along the Z axis
|
|
||||||
* @return rotated matrix
|
|
||||||
*/
|
|
||||||
static _CMatrix rotationZ(double angle) {return _CMatrix();}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Scaling the matrix along the X axis by the value "factor". Works only with 3x3 and 2x2 matrix,
|
|
||||||
* else return default construction of PIMathMatrixT
|
|
||||||
*
|
|
||||||
* @param factor is the value of scaling by X axis
|
|
||||||
* @return rotated matrix
|
|
||||||
*/
|
|
||||||
static _CMatrix scaleX(double factor) {return _CMatrix();}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Scaling the matrix along the Y axis by the value "factor". Works only with 3x3 and 2x2 matrix,
|
|
||||||
* else return default construction of PIMathMatrixT
|
|
||||||
*
|
|
||||||
* @param factor is the value of scaling by Y axis
|
|
||||||
* @return rotated matrix
|
|
||||||
*/
|
|
||||||
static _CMatrix scaleY(double factor) {return _CMatrix();}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Scaling the matrix along the Z axis by the value "factor". Works only with 3x3 matrix,
|
|
||||||
* else return default construction of PIMathMatrixT
|
|
||||||
*
|
|
||||||
* @param factor is the value of scaling by Z axis
|
|
||||||
* @return rotated matrix
|
|
||||||
*/
|
|
||||||
static _CMatrix scaleZ(double factor) {return _CMatrix();}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Method which returns number of columns in matrix
|
|
||||||
*
|
|
||||||
* @return type uint shows number of columns
|
|
||||||
*/
|
|
||||||
uint cols() const {return Cols;}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Method which returns number of rows in matrix
|
|
||||||
*
|
|
||||||
* @return type uint shows number of rows
|
* @return type uint shows number of rows
|
||||||
*/
|
*/
|
||||||
uint rows() const { return Rows; }
|
uint rows() const { return Rows; }
|
||||||
@@ -590,7 +521,11 @@ public:
|
|||||||
* @param index is the number of the selected column
|
* @param index is the number of the selected column
|
||||||
* @return column in PIMathVectorT format
|
* @return column in PIMathVectorT format
|
||||||
*/
|
*/
|
||||||
_CMCol col(uint index) {_CMCol tv; PIMM_FOR_R(i) tv[i] = m[i][index]; return tv;}
|
_CMCol col(uint index) {
|
||||||
|
_CMCol tv;
|
||||||
|
PIMM_FOR_R(i) tv[i] = m[i][index];
|
||||||
|
return tv;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Method which returns the selected row in PIMathVectorT format
|
* @brief Method which returns the selected row in PIMathVectorT format
|
||||||
@@ -598,7 +533,11 @@ public:
|
|||||||
* @param index is the number of the selected row
|
* @param index is the number of the selected row
|
||||||
* @return row in PIMathVectorT format
|
* @return row in PIMathVectorT format
|
||||||
*/
|
*/
|
||||||
_CMRow row(uint index) {_CMRow tv; PIMM_FOR_C(i) tv[i] = m[index][i]; return tv;}
|
_CMRow row(uint index) {
|
||||||
|
_CMRow tv;
|
||||||
|
PIMM_FOR_C(i) tv[i] = m[index][i];
|
||||||
|
return tv;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the selected column in matrix
|
* @brief Set the selected column in matrix
|
||||||
@@ -607,7 +546,10 @@ public:
|
|||||||
* @param v is a vector of the type _CMCol that needs to fill the column
|
* @param v is a vector of the type _CMCol that needs to fill the column
|
||||||
* @return matrix type _CMatrix
|
* @return matrix type _CMatrix
|
||||||
*/
|
*/
|
||||||
_CMatrix & setCol(uint index, const _CMCol & v) {PIMM_FOR_R(i) m[i][index] = v[i]; return *this;}
|
_CMatrix &setCol(uint index, const _CMCol &v) {
|
||||||
|
PIMM_FOR_R(i) m[i][index] = v[i];
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the selected row in matrix
|
* @brief Set the selected row in matrix
|
||||||
@@ -616,7 +558,10 @@ public:
|
|||||||
* @param v is a vector of the type _CMCol that needs to fill the row
|
* @param v is a vector of the type _CMCol that needs to fill the row
|
||||||
* @return matrix type _CMatrix
|
* @return matrix type _CMatrix
|
||||||
*/
|
*/
|
||||||
_CMatrix & setRow(uint index, const _CMRow & v) {PIMM_FOR_C(i) m[index][i] = v[i]; return *this;}
|
_CMatrix &setRow(uint index, const _CMRow &v) {
|
||||||
|
PIMM_FOR_C(i) m[index][i] = v[i];
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Method which changes selected rows in a matrix
|
* @brief Method which changes selected rows in a matrix
|
||||||
@@ -625,7 +570,15 @@ public:
|
|||||||
* @param r1 is the number of the second selected row
|
* @param r1 is the number of the second selected row
|
||||||
* @return matrix type _CMatrix
|
* @return matrix type _CMatrix
|
||||||
*/
|
*/
|
||||||
_CMatrix & swapRows(uint r0, uint r1) {Type t; PIMM_FOR_C(i) {t = m[r0][i]; m[r0][i] = m[r1][i]; m[r1][i] = t;} return *this;}
|
_CMatrix &swapRows(uint r0, uint r1) {
|
||||||
|
Type t;
|
||||||
|
PIMM_FOR_C(i) {
|
||||||
|
t = m[r0][i];
|
||||||
|
m[r0][i] = m[r1][i];
|
||||||
|
m[r1][i] = t;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Method which changes selected columns in a matrix
|
* @brief Method which changes selected columns in a matrix
|
||||||
@@ -634,7 +587,15 @@ public:
|
|||||||
* @param c1 is the number of the second selected column
|
* @param c1 is the number of the second selected column
|
||||||
* @return matrix type _CMatrix
|
* @return matrix type _CMatrix
|
||||||
*/
|
*/
|
||||||
_CMatrix & swapCols(uint c0, uint c1) {Type t; PIMM_FOR_R(i) {t = m[i][c0]; m[i][c0] = m[i][c1]; m[i][c1] = t;} return *this;}
|
_CMatrix &swapCols(uint c0, uint c1) {
|
||||||
|
Type t;
|
||||||
|
PIMM_FOR_R(i) {
|
||||||
|
t = m[i][c0];
|
||||||
|
m[i][c0] = m[i][c1];
|
||||||
|
m[i][c1] = t;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Method which fills the matrix with selected value
|
* @brief Method which fills the matrix with selected value
|
||||||
@@ -642,7 +603,10 @@ public:
|
|||||||
* @param v is a parameter the type and value of which is selected and later filled into the matrix
|
* @param v is a parameter the type and value of which is selected and later filled into the matrix
|
||||||
* @return filled matrix type _CMatrix
|
* @return filled matrix type _CMatrix
|
||||||
*/
|
*/
|
||||||
_CMatrix & fill(const Type & v) {PIMM_FOR_WB(r, c) m[r][c] = v; return *this;}
|
_CMatrix &fill(const Type &v) {
|
||||||
|
PIMM_FOR_WB(r, c) m[r][c] = v;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Method which checks if matrix is square
|
* @brief Method which checks if matrix is square
|
||||||
@@ -656,14 +620,20 @@ public:
|
|||||||
*
|
*
|
||||||
* @return true if matrix is identitied, else false
|
* @return true if matrix is identitied, else false
|
||||||
*/
|
*/
|
||||||
bool isIdentity() const {PIMM_FOR_WB(r, c) if ((c == r) ? m[r][c] != Type(1) : m[r][c] != Type(0)) return false; return true;}
|
bool isIdentity() const {
|
||||||
|
PIMM_FOR_WB(r, c) if ((c == r) ? m[r][c] != Type(1) : m[r][c] != Type(0)) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Method which checks if every elements of matrix are zeros
|
* @brief Method which checks if every elements of matrix are zeros
|
||||||
*
|
*
|
||||||
* @return true if matrix is null, else false
|
* @return true if matrix is null, else false
|
||||||
*/
|
*/
|
||||||
bool isNull() const {PIMM_FOR_WB(r, c) if (m[r][c] != Type(0)) return false; return true;}
|
bool isNull() const {
|
||||||
|
PIMM_FOR_WB(r, c) if (m[r][c] != Type(0)) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Full access to elements reference by row "row" and col "col"
|
* @brief Full access to elements reference by row "row" and col "col"
|
||||||
@@ -705,7 +675,10 @@ public:
|
|||||||
* @param sm matrix for the assigment
|
* @param sm matrix for the assigment
|
||||||
* @return matrix equal with sm
|
* @return matrix equal with sm
|
||||||
*/
|
*/
|
||||||
_CMatrix & operator =(const _CMatrix & sm) {memcpy(m, sm.m, sizeof(Type) * Cols * Rows); return *this;}
|
_CMatrix &operator=(const _CMatrix &sm) {
|
||||||
|
memcpy(m, sm.m, sizeof(Type) * Cols * Rows);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Compare with matrix "sm"
|
* @brief Compare with matrix "sm"
|
||||||
@@ -713,7 +686,10 @@ public:
|
|||||||
* @param sm matrix for the compare
|
* @param sm matrix for the compare
|
||||||
* @return if matrices are equal true, else false
|
* @return if matrices are equal true, else false
|
||||||
*/
|
*/
|
||||||
bool operator ==(const _CMatrix & sm) const {PIMM_FOR_WB(r, c) if (m[r][c] != sm.m[r][c]) return false; return true;}
|
bool operator==(const _CMatrix &sm) const {
|
||||||
|
PIMM_FOR_WB(r, c) if (m[r][c] != sm.m[r][c]) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Compare with matrix "sm"
|
* @brief Compare with matrix "sm"
|
||||||
@@ -756,7 +732,11 @@ public:
|
|||||||
*
|
*
|
||||||
* @return the result of matrix substraction
|
* @return the result of matrix substraction
|
||||||
*/
|
*/
|
||||||
_CMatrix operator -() const {_CMatrix tm; PIMM_FOR_WB(r, c) tm.m[r][c] = -m[r][c]; return tm;}
|
_CMatrix operator-() const {
|
||||||
|
_CMatrix tm;
|
||||||
|
PIMM_FOR_WB(r, c) tm.m[r][c] = -m[r][c];
|
||||||
|
return tm;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Matrix addition
|
* @brief Matrix addition
|
||||||
@@ -764,7 +744,11 @@ public:
|
|||||||
* @param sm is matrix term
|
* @param sm is matrix term
|
||||||
* @return the result of matrix addition
|
* @return the result of matrix addition
|
||||||
*/
|
*/
|
||||||
_CMatrix operator +(const _CMatrix & sm) const {_CMatrix tm = _CMatrix(*this); PIMM_FOR_WB(r, c) tm.m[r][c] += sm.m[r][c]; return tm;}
|
_CMatrix operator+(const _CMatrix &sm) const {
|
||||||
|
_CMatrix tm = _CMatrix(*this);
|
||||||
|
PIMM_FOR_WB(r, c) tm.m[r][c] += sm.m[r][c];
|
||||||
|
return tm;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Matrix substraction
|
* @brief Matrix substraction
|
||||||
@@ -772,7 +756,11 @@ public:
|
|||||||
* @param sm is matrix subtractor
|
* @param sm is matrix subtractor
|
||||||
* @return the result of matrix substraction
|
* @return the result of matrix substraction
|
||||||
*/
|
*/
|
||||||
_CMatrix operator -(const _CMatrix & sm) const {_CMatrix tm = _CMatrix(*this); PIMM_FOR_WB(r, c) tm.m[r][c] -= sm.m[r][c]; return tm;}
|
_CMatrix operator-(const _CMatrix &sm) const {
|
||||||
|
_CMatrix tm = _CMatrix(*this);
|
||||||
|
PIMM_FOR_WB(r, c) tm.m[r][c] -= sm.m[r][c];
|
||||||
|
return tm;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Matrix multiplication
|
* @brief Matrix multiplication
|
||||||
@@ -780,7 +768,11 @@ public:
|
|||||||
* @param v is value factor
|
* @param v is value factor
|
||||||
* @return the result of matrix multiplication
|
* @return the result of matrix multiplication
|
||||||
*/
|
*/
|
||||||
_CMatrix operator *(const Type & v) const {_CMatrix tm = _CMatrix(*this); PIMM_FOR_WB(r, c) tm.m[r][c] *= v; return tm;}
|
_CMatrix operator*(const Type &v) const {
|
||||||
|
_CMatrix tm = _CMatrix(*this);
|
||||||
|
PIMM_FOR_WB(r, c) tm.m[r][c] *= v;
|
||||||
|
return tm;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Matrix division
|
* @brief Matrix division
|
||||||
@@ -788,7 +780,11 @@ public:
|
|||||||
* @param v is value divider
|
* @param v is value divider
|
||||||
* @return the result of matrix division
|
* @return the result of matrix division
|
||||||
*/
|
*/
|
||||||
_CMatrix operator /(const Type & v) const {_CMatrix tm = _CMatrix(*this); PIMM_FOR_WB(r, c) tm.m[r][c] /= v; return tm;}
|
_CMatrix operator/(const Type &v) const {
|
||||||
|
_CMatrix tm = _CMatrix(*this);
|
||||||
|
PIMM_FOR_WB(r, c) tm.m[r][c] /= v;
|
||||||
|
return tm;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Determinant of the matrix is calculated
|
* @brief Determinant of the matrix is calculated
|
||||||
|
|||||||
Reference in New Issue
Block a user