PIMathMatrix.h documentation correction
This commit is contained in:
@@ -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