PIMathMatrix.h documentation correction
This commit is contained in:
@@ -29,10 +29,10 @@
|
||||
#include "pimathcomplex.h"
|
||||
|
||||
/**
|
||||
* @brief Inline funtion of compare with zero different types
|
||||
* @brief Floating point number specific comparison between value of matrix passed as parameter and zero
|
||||
*
|
||||
* @param v is input parameter of type T
|
||||
* @return true if zero, false if not zero
|
||||
* @param v floating point parameter for comparison
|
||||
* @return true if v in locality of zero, otherwise false
|
||||
*/
|
||||
template<typename T>
|
||||
inline bool _PIMathMatrixNullCompare(const T v) {
|
||||
@@ -41,10 +41,10 @@ inline bool _PIMathMatrixNullCompare(const T v) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Inline funtion of compare with zero colmplexf type
|
||||
* @brief Floating point number specific comparison between parameter value of matrix of complexf type and zero
|
||||
*
|
||||
* @param v is input parameter of type colmplexf
|
||||
* @return true if zero, false if not zero
|
||||
* @return true if absolute value of v in locality of zero, otherwise false
|
||||
*/
|
||||
template<>
|
||||
inline bool _PIMathMatrixNullCompare<complexf>(const complexf v) {
|
||||
@@ -52,10 +52,10 @@ inline bool _PIMathMatrixNullCompare<complexf>(const complexf v) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Inline funtion of compare with zero complexd type
|
||||
* @brief Floating point number specific comparison between parameter value of matrix of complexd type and zero
|
||||
*
|
||||
* @param v is input parameter of type colmplexd
|
||||
* @return true if zero, false if not zero
|
||||
* @return true if absolute value of v in locality of zero, otherwise false
|
||||
*/
|
||||
template<>
|
||||
inline bool _PIMathMatrixNullCompare<complexd>(const complexd v) {
|
||||
@@ -120,10 +120,10 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a matrix that is filled with elements
|
||||
* @brief Creates a matrix and sets it with elements equal to value "v"
|
||||
*
|
||||
* @param v is a parameter the type and value of which is selected and later filled into the matrix
|
||||
* @return filled matrix of type PIMathMatrixT
|
||||
* @return filled matrix of type PIMathMatrixT equal to "v"
|
||||
*/
|
||||
static _CMatrix filled(const Type &v) {
|
||||
_CMatrix tm;
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
* else return default construction of PIMathMatrixT
|
||||
*
|
||||
* @param angle is the angle of rotation of the matrix along the X axis
|
||||
* @return rotated matrix
|
||||
* @return rotated matrix along the X axis
|
||||
*/
|
||||
static _CMatrix rotationX(double angle) { return _CMatrix(); }
|
||||
|
||||
@@ -154,7 +154,7 @@ public:
|
||||
* else return default construction of PIMathMatrixT
|
||||
*
|
||||
* @param angle is the angle of rotation of the matrix along the Y axis
|
||||
* @return rotated matrix
|
||||
* @return rotated matrix along the Y axis
|
||||
*/
|
||||
static _CMatrix rotationY(double angle) { return _CMatrix(); }
|
||||
|
||||
@@ -163,7 +163,7 @@ public:
|
||||
* else return default construction of PIMathMatrixT
|
||||
*
|
||||
* @param angle is the angle of rotation of the matrix along the Z axis
|
||||
* @return rotated matrix
|
||||
* @return rotated matrix along the Z axis
|
||||
*/
|
||||
static _CMatrix rotationZ(double angle) { return _CMatrix(); }
|
||||
|
||||
@@ -172,7 +172,7 @@ public:
|
||||
* else return default construction of PIMathMatrixT
|
||||
*
|
||||
* @param factor is the value of scaling by X axis
|
||||
* @return rotated matrix
|
||||
* @return rotated matrix along the axis X
|
||||
*/
|
||||
static _CMatrix scaleX(double factor) { return _CMatrix(); }
|
||||
|
||||
@@ -181,7 +181,7 @@ public:
|
||||
* else return default construction of PIMathMatrixT
|
||||
*
|
||||
* @param factor is the value of scaling by Y axis
|
||||
* @return rotated matrix
|
||||
* @return rotated matrix along the axis Y
|
||||
*/
|
||||
static _CMatrix scaleY(double factor) { return _CMatrix(); }
|
||||
|
||||
@@ -190,26 +190,26 @@ public:
|
||||
* else return default construction of PIMathMatrixT
|
||||
*
|
||||
* @param factor is the value of scaling by Z axis
|
||||
* @return rotated matrix
|
||||
* @return rotated matrix along the axis Z
|
||||
*/
|
||||
static _CMatrix scaleZ(double factor) { return _CMatrix(); }
|
||||
|
||||
/**
|
||||
* @brief Method which returns number of columns in matrix
|
||||
* @brief Method which returns number of columns in this matrix
|
||||
*
|
||||
* @return type uint shows number of columns
|
||||
* @return number of columns
|
||||
*/
|
||||
uint cols() const { return Cols; }
|
||||
|
||||
/**
|
||||
* @brief Method which returns number of rows in matrix
|
||||
* @brief Method which returns number of rows in this matrix
|
||||
*
|
||||
* @return type uint shows number of rows
|
||||
* @return number of rows
|
||||
*/
|
||||
uint rows() const { return Rows; }
|
||||
|
||||
/**
|
||||
* @brief Method which returns the selected column in PIMathVectorT format.
|
||||
* @brief Method which returns the selected column of this matrix in PIMathVectorT format.
|
||||
* If you enter an index out of the border of the matrix there will be "undefined behavior"
|
||||
*
|
||||
* @param index is the number of the selected column
|
||||
@@ -222,7 +222,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Method which returns the selected row in PIMathVectorT format
|
||||
* @brief Method which returns the selected row of this matrix in PIMathVectorT format.
|
||||
* If you enter an index out of the border of the matrix there will be "undefined behavior"
|
||||
*
|
||||
* @param index is the number of the selected row
|
||||
@@ -261,7 +261,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Method which changes selected rows in this matrix.
|
||||
* @brief Method which permutes the values of two selected rows among themselves in this matrix.
|
||||
* If you enter an index out of the border of the matrix there will be "undefined behavior"
|
||||
*
|
||||
* @param r0 is the number of the first selected row
|
||||
@@ -279,7 +279,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Method which changes selected columns in this matrix.
|
||||
* @brief Method which permutes the values of two selected columns among themselves in this matrix.
|
||||
* If you enter an index out of the border of the matrix there will be "undefined behavior"
|
||||
*
|
||||
* @param c0 is the number of the first selected column
|
||||
@@ -308,7 +308,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Method which checks if matrix is square
|
||||
* @brief Method which checks if this matrix is square
|
||||
*
|
||||
* @return true if matrix is square, else false
|
||||
*/
|
||||
@@ -335,24 +335,14 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Full access to elements reference by row "row" and col "col".
|
||||
* @brief Read-only access to elements reference by row "row" and column "col".
|
||||
* If you enter an index out of the border of the matrix there will be "undefined behavior"
|
||||
*
|
||||
* @param row is a parameter that shows the row number of the matrix of the selected element
|
||||
* @param col is a parameter that shows the column number of the matrix of the selected element
|
||||
* @return reference to element of matrix by row "row" and col "col"
|
||||
* @return reference to element of this matrix
|
||||
*/
|
||||
Type &at(uint row, uint col) { return m[row][col]; }
|
||||
|
||||
/**
|
||||
* @brief Full access to element by row "row" and col "col".
|
||||
* If you enter an index out of the border of the matrix there will be "undefined behavior"
|
||||
*
|
||||
* @param row is a parameter that shows the row number of the matrix of the selected element
|
||||
* @param col is a parameter that shows the column number of the matrix of the selected element
|
||||
* @return element of matrix by row "row" and col "col"
|
||||
*/
|
||||
Type at(uint row, uint col) const { return m[row][col]; }
|
||||
const Type &at(uint row, uint col) { return m[row][col]; }
|
||||
|
||||
/**
|
||||
* @brief Full access to the matrix row pointer. If you enter an index out of the border of the matrix there will be "undefined behavior"
|
||||
@@ -371,10 +361,10 @@ public:
|
||||
const Type *operator[](uint row) const { return m[row]; }
|
||||
|
||||
/**
|
||||
* @brief Matrix assignment to matrix "sm"
|
||||
* @brief Assignment all elements of this matrix with all elements of matrix "sm"
|
||||
*
|
||||
* @param sm matrix for the assigment
|
||||
* @return this matrix equal with sm
|
||||
* @param sm matrix used for the assignment
|
||||
* @return matrix whose each element is equal to each element of the matrix "sm"
|
||||
*/
|
||||
_CMatrix &operator=(const _CMatrix &sm) {
|
||||
memcpy(m, sm.m, sizeof(Type) * Cols * Rows);
|
||||
@@ -382,9 +372,9 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Compare with matrix "sm"
|
||||
* @brief Compare all elements of this matrix with all elements of matrix "sm"
|
||||
*
|
||||
* @param sm matrix for the compare
|
||||
* @param sm matrix used for the compare
|
||||
* @return if matrices are equal true, else false
|
||||
*/
|
||||
bool operator==(const _CMatrix &sm) const {
|
||||
@@ -393,36 +383,36 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Compare with matrix "sm"
|
||||
* @brief Compare all elements of this matrix with all elements of matrix "sm"
|
||||
*
|
||||
* @param sm matrix for the compare
|
||||
* @param sm matrix used for the compare
|
||||
* @return if matrices are not equal true, else false
|
||||
*/
|
||||
bool operator!=(const _CMatrix &sm) const { return !(*this == sm); }
|
||||
|
||||
/**
|
||||
* @brief Addition assignment with matrix "sm"
|
||||
* @brief Addition all elements of this matrix with all elements matrix "sm"
|
||||
*
|
||||
* @param sm matrix for the addition assigment
|
||||
*/
|
||||
void operator+=(const _CMatrix &sm) { PIMM_FOR_WB(r, c) m[r][c] += sm.m[r][c]; }
|
||||
|
||||
/**
|
||||
* @brief Subtraction assignment with matrix "sm"
|
||||
* @brief Subtraction all elements of this matrix with all elements matrix "sm"
|
||||
*
|
||||
* @param sm matrix for the subtraction assigment
|
||||
*/
|
||||
void operator-=(const _CMatrix &sm) { PIMM_FOR_WB(r, c) m[r][c] -= sm.m[r][c]; }
|
||||
|
||||
/**
|
||||
* @brief Multiplication assignment with value "v"
|
||||
* @brief Multiplication all elements of this matrix with value "v"
|
||||
*
|
||||
* @param v value for the multiplication assigment
|
||||
*/
|
||||
void operator*=(const Type &v) { PIMM_FOR_WB(r, c) m[r][c] *= v; }
|
||||
|
||||
/**
|
||||
* @brief Division assignment with value "v"
|
||||
* @brief Division all elements of this matrix with value "v"
|
||||
*
|
||||
* @param v value for the division assigment
|
||||
*/
|
||||
@@ -440,7 +430,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Matrix addition
|
||||
* @brief Addition all elements of this matrix with all elements of matrix "sm"
|
||||
*
|
||||
* @param sm is matrix term
|
||||
* @return the result of matrix addition
|
||||
@@ -452,7 +442,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Matrix substraction
|
||||
* @brief Substraction all elements of this matrix with all elements of matrix "sm"
|
||||
*
|
||||
* @param sm is matrix subtractor
|
||||
* @return the result of matrix substraction
|
||||
@@ -464,7 +454,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Matrix multiplication
|
||||
* @brief Multiplication all elements of this matrix with value "v"
|
||||
*
|
||||
* @param v is value factor
|
||||
* @return the result of matrix multiplication
|
||||
@@ -476,7 +466,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Matrix division
|
||||
* @brief Division all elements of this matrix with value "v"
|
||||
*
|
||||
* @param v is value divider
|
||||
* @return the result of matrix division
|
||||
@@ -731,11 +721,11 @@ inline std::ostream & operator <<(std::ostream & s, const PIMathMatrixT<Rows, Co
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Add matrix "m" at the end of matrix and return reference to matrix
|
||||
* @brief Outputting the matrix to the console
|
||||
*
|
||||
* @param s PICout type
|
||||
* @param m PIMathMatrixT type
|
||||
* @return bitwise left PICout
|
||||
* @param the matrix type PIMathMatrixT that we print to the console
|
||||
* @return PIMathMatrix printed to the console
|
||||
*/
|
||||
template<uint Rows, uint Cols, typename Type>
|
||||
inline PICout operator<<(PICout s, const PIMathMatrixT<Rows, Cols, Type> &m) {
|
||||
@@ -965,7 +955,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Method which replace selected columns in this matrix. You cannot use an index larger than the number of columns,
|
||||
* @brief Method which permutes the values of two selected columns among themselves in this matrix. You cannot use an index larger than the number of columns,
|
||||
* otherwise there will be "undefined behavior"
|
||||
*
|
||||
* @param r0 is the number of the first selected row
|
||||
@@ -978,7 +968,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Method which replace selected rows in this matrix. You cannot use an index larger than the number of rows,
|
||||
* @briefMethod which permutes the values of two selected rows among themselves in this matrix. You cannot use an index larger than the number of rows,
|
||||
* otherwise there will be "undefined behavior"
|
||||
*
|
||||
* @param c0 is the number of the first selected row
|
||||
@@ -1036,9 +1026,9 @@ public:
|
||||
bool isValid() const { return !PIVector2D<Type>::isEmpty(); }
|
||||
|
||||
/**
|
||||
* @brief Matrix assignment to matrix "v"
|
||||
* @brief Assignment all elements of this matrix with all elements of matrix "sm"
|
||||
*
|
||||
* @param v matrix for the assigment
|
||||
* @param v matrix used for the assigment
|
||||
* @return reference to this matrix equal with v
|
||||
*/
|
||||
_CMatrix &operator=(const PIVector<PIVector<Type> > &v) {
|
||||
@@ -1047,9 +1037,9 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Compare with matrix "sm"
|
||||
* @brief Compare all elements of this matrix with all elements of matrix "sm"
|
||||
*
|
||||
* @param sm matrix for the compare
|
||||
* @param sm matrix used for the compare
|
||||
* @return if matrices are equal true, else false
|
||||
*/
|
||||
bool operator==(const _CMatrix &sm) const {
|
||||
@@ -1058,36 +1048,36 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Compare with matrix "sm"
|
||||
* @brief Compare all elements of this matrix with all elements of matrix "sm"
|
||||
*
|
||||
* @param sm matrix for the compare
|
||||
* @param sm matrix used for the compare
|
||||
* @return if matrices are not equal true, else false
|
||||
*/
|
||||
bool operator!=(const _CMatrix &sm) const { return !(*this == sm); }
|
||||
|
||||
/**
|
||||
* @brief Addition assignment with matrix "sm"
|
||||
* @brief Addition all elements of this matrix with all elements matrix "sm"
|
||||
*
|
||||
* @param sm matrix for the addition assigment
|
||||
*/
|
||||
void operator+=(const _CMatrix &sm) { PIMM_FOR_A(i) _V2D::mat[i] += sm.mat[i]; }
|
||||
|
||||
/**
|
||||
* @brief Subtraction assignment with matrix "sm"
|
||||
* @brief Subtraction all elements of this matrix with all elements matrix "sm"
|
||||
*
|
||||
* @param sm matrix for the subtraction assigment
|
||||
*/
|
||||
void operator-=(const _CMatrix &sm) { PIMM_FOR_A(i) _V2D::mat[i] -= sm.mat[i]; }
|
||||
|
||||
/**
|
||||
* @brief Multiplication assignment with value "v"
|
||||
* @brief Multiplication all elements of this matrix with value "v"
|
||||
*
|
||||
* @param v value for the multiplication assigment
|
||||
*/
|
||||
void operator*=(const Type &v) { PIMM_FOR_A(i) _V2D::mat[i] *= v; }
|
||||
|
||||
/**
|
||||
* @brief Division assignment with value "v"
|
||||
* @brief Division all elements of this matrix with value "v"
|
||||
*
|
||||
* @param v value for the division assigment
|
||||
*/
|
||||
@@ -1105,7 +1095,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Matrix addition
|
||||
* @brief Addition all elements of this matrix with all elements of matrix "sm"
|
||||
*
|
||||
* @param sm is matrix term
|
||||
* @return the result of matrix addition
|
||||
@@ -1117,7 +1107,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Matrix subtraction
|
||||
* @brief Substraction all elements of this matrix with all elements of matrix "sm"
|
||||
*
|
||||
* @param sm is matrix subtractor
|
||||
* @return the result of matrix subtraction
|
||||
@@ -1129,7 +1119,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Matrix multiplication
|
||||
* @brief Multiplication all elements of this matrix with value "v"
|
||||
*
|
||||
* @param v is value factor
|
||||
* @return the result of matrix multiplication
|
||||
@@ -1141,7 +1131,7 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Matrix division
|
||||
* @brief Division all elements of this matrix with value "v"
|
||||
*
|
||||
* @param v is value divider
|
||||
* @return the result of matrix division
|
||||
@@ -1328,7 +1318,7 @@ inline std::ostream & operator <<(std::ostream & s, const PIMathMatrix<Type> & m
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Inline operator for outputting the matrix to the console
|
||||
* @brief Outputting the matrix to the console
|
||||
*
|
||||
* @param s PICout type
|
||||
* @param the matrix type PIMathMatrix that we print to the console
|
||||
@@ -1349,7 +1339,7 @@ inline PICout operator<<(PICout s, const PIMathMatrix<Type> &m) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Inline operator for serializing a matrix into a PIByteArray
|
||||
* @brief Serializing a matrix into a PIByteArray
|
||||
*
|
||||
* @param s PIByteArray type
|
||||
* @param v PIMathMatrix type
|
||||
@@ -1362,7 +1352,7 @@ inline PIByteArray &operator<<(PIByteArray &s, const PIMathMatrix<Type> &v) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Inline operator to deserialize matrix from PIByteArray
|
||||
* @brief Deserializing matrix from PIByteArray
|
||||
*
|
||||
* @param s PIByteArray type
|
||||
* @param v PIMathMatrix type
|
||||
|
||||
@@ -128,57 +128,51 @@ public:
|
||||
|
||||
/**
|
||||
* @brief Method that returns the cos of the current vector and vector "v"
|
||||
* If the vectors have different dimensions, it returns false
|
||||
*
|
||||
* @param v vector of type PIMathVectorT
|
||||
* @return cos value of the angle between two vectors
|
||||
*/
|
||||
Type angleCos(const _CVector & v) const {if(v.size() != Size) return false; Type tv = v.length() * length(); return (tv == Type(0) ? Type(0) : ((*this) ^ v) / tv);}
|
||||
Type angleCos(const _CVector & v) const {Type tv = v.length() * length(); return (tv == Type(0) ? Type(0) : ((*this) ^ v) / tv);}
|
||||
|
||||
/**
|
||||
* @brief Method that returns the sin of the current vector and vector "v". Works only with vectors which consists of 3 elements.
|
||||
* If the vectors have different dimensions, it returns false
|
||||
* @brief Method that returns the sin of the current vector and vector "v". Works only with vectors which consists of 3 elements
|
||||
*
|
||||
* @param v vector of type PIMathVectorT
|
||||
* @return sin value of the angle between two vector
|
||||
*/
|
||||
Type angleSin(const _CVector & v) const {if(v.size() != Size) return false; Type tv = angleCos(v); return sqrt(Type(1) - tv * tv);}
|
||||
Type angleSin(const _CVector & v) const {Type tv = angleCos(v); return sqrt(Type(1) - tv * tv);}
|
||||
|
||||
/**
|
||||
* @brief Method that returns the angle between of the current vector and vector "v" in Rad.
|
||||
* If the vectors have different dimensions, it returns false
|
||||
* @brief Method that returns the angle between of the current vector and vector "v" in Rad
|
||||
*
|
||||
* @param v vector of type PIMathVectorT
|
||||
* @return value of the angle between two vectors in Rad
|
||||
*/
|
||||
Type angleRad(const _CVector & v) const {if(v.size() != Size) return false; return acos(angleCos(v));}
|
||||
Type angleRad(const _CVector & v) const {return acos(angleCos(v));}
|
||||
|
||||
/**
|
||||
* @brief Method that returns the angle between of the current vector and vector "v" in Deg.
|
||||
* If the vectors have different dimensions, it returns false
|
||||
* @brief Method that returns the angle between of the current vector and vector "v" in Deg
|
||||
*
|
||||
* @param v vector of type PIMathVectorT
|
||||
* @return value of the angle between two vectors in Deg
|
||||
*/
|
||||
Type angleDeg(const _CVector & v) const {if(v.size() != Size) return false; return toDeg(acos(angleCos(v)));}
|
||||
Type angleDeg(const _CVector & v) const {return toDeg(acos(angleCos(v)));}
|
||||
|
||||
/**
|
||||
* @brief Method that returns the angle elevation between of the current vector and vector "v" in Deg.
|
||||
* If the vectors have different dimensions, it returns false
|
||||
* @brief Method that returns the angle elevation between of the current vector and vector "v" in Deg
|
||||
*
|
||||
* @param v vector of type PIMathVectorT
|
||||
* @return value of the angle elevation between two vectors in Deg
|
||||
*/
|
||||
Type angleElevation(const _CVector & v) const {if(v.size() != Size) return false; _CVector z = v - *this; double c = z.angleCos(*this); return 90.0 - acos(c) * rad2deg;}
|
||||
Type angleElevation(const _CVector & v) const {_CVector z = v - *this; double c = z.angleCos(*this); return 90.0 - acos(c) * rad2deg;}
|
||||
|
||||
/**
|
||||
* @brief Method that returns a vector equal to the projection of the current vector onto the vector "v".
|
||||
* If the vectors have different dimensions, it returns this without changing anything
|
||||
*
|
||||
* @param v vector of type PIMathVectorT
|
||||
* @return vector of type PIMathVectorT equal to the projection of the current vector onto the vector "v"
|
||||
*/
|
||||
_CVector projection(const _CVector & v) {if(v.size() != Size) return _CVector(*this); Type tv = v.length(); return (tv == Type(0) ? _CVector() : v * (((*this) ^ v) / tv));}
|
||||
_CVector projection(const _CVector & v) {Type tv = v.length(); return (tv == Type(0) ? _CVector() : v * (((*this) ^ v) / tv));}
|
||||
|
||||
/**
|
||||
* @brief Method that returns this normalized vector
|
||||
@@ -218,12 +212,11 @@ public:
|
||||
bool isNull() const {PIMV_FOR(i, 0) if (c[i] != Type(0)) return false; return true;}
|
||||
|
||||
/**
|
||||
* @brief Method which checks if current vector is orthogonal to vector "v".
|
||||
* If the vectors have different dimensions, it returns false
|
||||
* @brief Method which checks if current vector is orthogonal to vector "v"
|
||||
*
|
||||
* @param v vector of type PIMathVectorT
|
||||
* @return true if vectors are orthogonal, else fal */
|
||||
bool isOrtho(const _CVector & v) const {if(v.size() != Size) return false; return ((*this) ^ v) == Type(0);}
|
||||
bool isOrtho(const _CVector & v) const {return ((*this) ^ v) == Type(0);}
|
||||
|
||||
/**
|
||||
* @brief Read-only access to elements reference by index of the vector element "index"
|
||||
@@ -283,18 +276,18 @@ public:
|
||||
bool operator !=(const _CVector & v) const {return !(*this == v);}
|
||||
|
||||
/**
|
||||
* @brief Vector addition this vector with vector "v". If the vectors have different dimensions, it returns void()
|
||||
* @brief Vector addition this vector with vector "v"
|
||||
*
|
||||
* @param v vector for the addition assigment
|
||||
*/
|
||||
void operator +=(const _CVector & v) {if(v.size() != Size) return void(); PIMV_FOR(i, 0) c[i] += v[i];}
|
||||
void operator +=(const _CVector & v) {PIMV_FOR(i, 0) c[i] += v[i];}
|
||||
|
||||
/**
|
||||
* @brief Subtraction assignmentthis vector with vector "v". If the vectors have different dimensions, it returns void()
|
||||
* @brief Subtraction assignmentthis vector with vector "v"
|
||||
*
|
||||
* @param v vector for the subtraction assigment
|
||||
*/
|
||||
void operator -=(const _CVector & v) {if(v.size() != Size) return void(); PIMV_FOR(i, 0) c[i] -= v[i];}
|
||||
void operator -=(const _CVector & v) {PIMV_FOR(i, 0) c[i] -= v[i];}
|
||||
|
||||
/**
|
||||
* @brief Multiplication assignment this vector with value "v"
|
||||
@@ -304,11 +297,11 @@ public:
|
||||
void operator *=(const Type & v) {PIMV_FOR(i, 0) c[i] *= v;}
|
||||
|
||||
/**
|
||||
* @brief Multiplication assignment this vector with vector "v". If the vectors have different dimensions, it returns void()
|
||||
* @brief Multiplication assignment this vector with vector "v"
|
||||
*
|
||||
* @param v vector for the multiplication assigment
|
||||
*/
|
||||
void operator *=(const _CVector & v) {if(v.size() != Size) return void(); PIMV_FOR(i, 0) c[i] *= v[i];}
|
||||
void operator *=(const _CVector & v) {PIMV_FOR(i, 0) c[i] *= v[i];}
|
||||
|
||||
/**
|
||||
* @brief Division assignment with this vector value "v"
|
||||
@@ -318,11 +311,11 @@ public:
|
||||
void operator /=(const Type & v) {PIMV_FOR(i, 0) c[i] /= v;}
|
||||
|
||||
/**
|
||||
* @brief Division assignment this vector with vector "v". If the vectors have different dimensions, it returns void()
|
||||
* @brief Division assignment this vector with vector "v"
|
||||
*
|
||||
* @param v vector for the division assigment
|
||||
*/
|
||||
void operator /=(const _CVector & v) {if(v.size() != Size) return void(); PIMV_FOR(i, 0) c[i] /= v[i];}
|
||||
void operator /=(const _CVector & v) {PIMV_FOR(i, 0) c[i] /= v[i];}
|
||||
|
||||
/**
|
||||
* @brief Vector substraction this vector
|
||||
@@ -332,20 +325,20 @@ public:
|
||||
_CVector operator -() const {_CVector tv; PIMV_FOR(i, 0) tv[i] = -c[i]; return tv;}
|
||||
|
||||
/**
|
||||
* @brief Vector addition this vector with vector "v". If the vectors have different dimensions, it returns this without changing anything
|
||||
* @brief Vector addition this vector with vector "v"
|
||||
*
|
||||
* @param v is vector term
|
||||
* @return the result of vector addition
|
||||
*/
|
||||
_CVector operator +(const _CVector & v) const {if(v.size() != Size) return _CVector(*this); _CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] += v[i]; return tv;}
|
||||
_CVector operator +(const _CVector & v) const {_CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] += v[i]; return tv;}
|
||||
|
||||
/**
|
||||
* @brief Vector substraction this vector with vector "v". If the vectors have different dimensions, it returns this without changing anything
|
||||
* @brief Vector substraction this vector with vector "v"
|
||||
*
|
||||
* @param v is vector term
|
||||
* @return the result of vector substraction
|
||||
*/
|
||||
_CVector operator -(const _CVector & v) const {if(v.size() != Size) return _CVector(*this); _CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] -= v[i]; return tv;}
|
||||
_CVector operator -(const _CVector & v) const {_CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] -= v[i]; return tv;}
|
||||
|
||||
/**
|
||||
* @brief Vector multiplication this vector with value "v"
|
||||
@@ -364,12 +357,12 @@ public:
|
||||
_CVector operator /(const Type & v) const {_CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] /= v; return tv;}
|
||||
|
||||
/**
|
||||
* @brief Vector division this vector with vector "v". If the vectors have different dimensions, it returns this without changing anything
|
||||
* @brief Vector division this vector with vector "v"
|
||||
*
|
||||
* @param v is vector divider
|
||||
* @return the result of vector division
|
||||
*/
|
||||
_CVector operator /(const _CVector & v) const {if(v.size() != Size) return _CVector(*this); _CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] /= v[i]; return tv;}
|
||||
_CVector operator /(const _CVector & v) const {_CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] /= v[i]; return tv;}
|
||||
|
||||
/**
|
||||
* @brief Cross product of two vectors. Works only with vector containing three elements, otherwise returns current vector
|
||||
@@ -380,20 +373,20 @@ public:
|
||||
_CVector operator *(const _CVector & v) const {if (Size != 3) return _CVector(); _CVector tv; tv.fill(Type(1)); tv[0] = c[1]*v[2] - v[1]*c[2]; tv[1] = v[0]*c[2] - c[0]*v[2]; tv[2] = c[0]*v[1] - v[0]*c[1]; return tv;}
|
||||
|
||||
/**
|
||||
* @brief Elementwise assignment of multiplication of two vectors. If the vectors have different dimensions, it returns this without changing anything
|
||||
* @brief Elementwise assignment of multiplication of two vectors
|
||||
*
|
||||
* @param v is vector for multiplication
|
||||
* @return resulting vector
|
||||
*/
|
||||
_CVector operator &(const _CVector & v) const {if(v.size() != Size) return _CVector(*this); _CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] *= v[i]; return tv;}
|
||||
_CVector operator &(const _CVector & v) const {_CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] *= v[i]; return tv;}
|
||||
|
||||
/**
|
||||
* @brief Absolute value of the dot product. If the vectors have different dimensions, it returns false
|
||||
* @brief Absolute value of the dot product
|
||||
*
|
||||
* @param v is vector for dot product
|
||||
* @return resulting vector
|
||||
*/
|
||||
Type operator ^(const _CVector & v) const {if(v.size() != Size) return false; Type tv(0); PIMV_FOR(i, 0) tv += c[i] * v[i]; return tv;}
|
||||
Type operator ^(const _CVector & v) const {Type tv(0); PIMV_FOR(i, 0) tv += c[i] * v[i]; return tv;}
|
||||
|
||||
PIMathMatrixT<1, Size, Type> transposed() const {
|
||||
PIMathMatrixT<1, Size, Type> ret;
|
||||
|
||||
Reference in New Issue
Block a user