tab correction

This commit is contained in:
2020-09-25 13:19:10 +03:00
parent 0940e8fa44
commit 5da9d6e43b

View File

@@ -66,44 +66,44 @@ public:
PIMathVectorT(const _CVector & st, const _CVector & fn) {resize(); set(st, fn);}
/**
* @brief Method that returns the number of elements contained in the vector
* @brief Method that returns the number of elements contained in the vector
*
* @return type uint shows number of elements in this vector
*/
uint size() const {return Size;}
/**
* @brief Method that set this elements to value "v"
* @brief Method that set this elements to value "v"
*
* @param v value of which the vector is filled
* @return reference to this
* @return reference to this
*/
_CVector & fill(const Type & v) {PIMV_FOR(i, 0) c[i] = v; return *this;}
/**
* @brief Method that set this with the subtraction of two vectors
* @brief Method that set this with the subtraction of two vectors
*
* @param st vector of type PIMathVectorT
* @param fn vector of type PIMathVectorT
* @return reference to this
* @return reference to this
*/
_CVector & set(const _CVector & st, const _CVector & fn) {PIMV_FOR(i, 0) c[i] = fn[i] - st[i]; return *this;}
/**
* @brief Method that sets this using a vector, each element of which is added to the value of "v"
* @brief Method that sets this using a vector, each element of which is added to the value of "v"
*
* @param v value of which the vector is filled
* @return reference to this
* @return reference to this
*/
_CVector & move(const Type & v) {PIMV_FOR(i, 0) c[i] += v; return *this;}
/**
* @brief Method that sets this with a vector, each element of which is added to each element of the vector "v"
* @brief Method that sets this with a vector, each element of which is added to each element of the vector "v"
*
* @param v vector of type PIMathVectorT
* @return reference to this
* @return reference to this
*/
_CVector & move(const _CVector & v) {PIMV_FOR(i, 0) c[i] += v[i]; return *this;}
_CVector & move(const _CVector & v) {PIMV_FOR(i, 0) c[i] += v[i]; return *this;}
/**
* @brief Method that returns sum of the squares of all elements of the vector
@@ -113,7 +113,7 @@ public:
Type lengthSqr() const {Type tv(0); PIMV_FOR(i, 0) tv += (c[i] * c[i]); return tv;}
/**
* @brief Method that returns a scalar physical value equal to the absolute value of vector
* @brief Method that returns a scalar physical value equal to the absolute value of vector
*
* @return value equal to length of a vector
*/
@@ -128,62 +128,62 @@ public:
/**
* @brief Method that returns the cos of the current vector and vector "v"
* If the vectors have different dimensions, it returns false
* 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 {if(v.size() != Size) return false; 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.
* If the vectors have different dimensions, it returns false
*
* @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 {if(v.size() != Size) return false; 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.
* If the vectors have different dimensions, it returns false
*
* @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 {if(v.size() != Size) return false; 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.
* If the vectors have different dimensions, it returns false
*
* @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 {if(v.size() != Size) return false; 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.
* If the vectors have different dimensions, it returns false
*
* @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 {if(v.size() != Size) return false; _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
* @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) {if(v.size() != Size) return _CVector(*this); Type tv = v.length(); return (tv == Type(0) ? _CVector() : v * (((*this) ^ v) / tv));}
/**
* @brief Method that returns this normalized vector
* @brief Method that returns this normalized vector
*
* @return reference to this
* @return reference to this
*/
_CVector & normalize() {Type tv = length(); if (tv == Type(1)) return *this; if (piAbs<Type>(tv) <= Type(1E-100)) {fill(Type(0)); return *this;} PIMV_FOR(i, 0) c[i] /= tv; return *this;}
@@ -218,13 +218,12 @@ 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".
* If the vectors have different dimensions, it returns false
*
* @param v vector of type PIMathVectorT
* @return true if vectors are orthogonal, else false
*/
bool isOrtho(const _CVector & v) const {if(v.size() != Size) return false; return ((*this) ^ v) == Type(0);}
* @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);}
/**
* @brief Read-only access to elements reference by index of the vector element "index"
@@ -249,10 +248,10 @@ public:
* @param index is the index of necessary element
* @return element of vector
*/
const Type & operator [](uint index) const {return c[index];}
const Type & operator [](uint index) const {return c[index];}
/**
* @brief Vector assignment to vector "v" of type PIMathVectorT
* @brief Vector assignment to vector "v" of type PIMathVectorT
*
* @param v vector for the assigment
* @return vector equal to vector "v"
@@ -260,12 +259,12 @@ public:
_CVector & operator =(const _CVector & v) {memcpy(c, v.c, sizeof(Type) * Size); return *this;}
/**
* @brief Assignment operation. All vector values become equal to "v"
* @brief Assignment operation. All vector values become equal to "v"
*
* @param v value for the assigment
* @return reference to this
* @return reference to this
*/
_CVector & operator =(const Type & v) {PIMV_FOR(i, 0) c[i] = v; return *this;}
_CVector & operator =(const Type & v) {PIMV_FOR(i, 0) c[i] = v; return *this;}
/**
* @brief Compare with vector "v"
@@ -284,72 +283,72 @@ 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". If the vectors have different dimensions, it returns void()
*
* @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) {if(v.size() != Size) return void(); 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". If the vectors have different dimensions, it returns void()
*
* @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) {if(v.size() != Size) return void(); PIMV_FOR(i, 0) c[i] -= v[i];}
/**
* @brief Multiplication assignment this vector with value "v"
* @brief Multiplication assignment this vector with value "v"
*
* @param v value for the multiplication assigment
*/
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". If the vectors have different dimensions, it returns void()
*
* @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) {if(v.size() != Size) return void(); PIMV_FOR(i, 0) c[i] *= v[i];}
/**
* @brief Division assignment with this vector value "v"
* @brief Division assignment with this vector value "v"
*
* @param v value for the division assigment
*/
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". If the vectors have different dimensions, it returns void()
*
* @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) {if(v.size() != Size) return void(); PIMV_FOR(i, 0) c[i] /= v[i];}
/**
* @brief Vector substraction this vector
* @brief Vector substraction this vector
*
* @return the result of vector substraction
*/
_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". If the vectors have different dimensions, it returns this without changing anything
*
* @param v is vector term
* @return the result of vector addition
* @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 {if(v.size() != Size) return _CVector(*this); _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". If the vectors have different dimensions, it returns this without changing anything
*
* @param v is vector term
* @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 {if(v.size() != Size) return _CVector(*this); _CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] -= v[i]; return tv;}
/**
* @brief Vector multiplication this vector with value "v"
* @brief Vector multiplication this vector with value "v"
*
* @param v is value factor
* @return the result of vector multiplication
@@ -357,7 +356,7 @@ 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 value "v"
* @brief Vector division this vector with value "v"
*
* @param v is value divider
* @return the result of vector division
@@ -365,12 +364,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". If the vectors have different dimensions, it returns this without changing anything
*
* @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 {if(v.size() != Size) return _CVector(*this); _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
@@ -381,20 +380,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. If the vectors have different dimensions, it returns this without changing anything
*
* @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 {if(v.size() != Size) return _CVector(*this); _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. If the vectors have different dimensions, it returns false
*
* @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 {if(v.size() != Size) return false; 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;
@@ -411,7 +410,7 @@ public:
PIMathVectorT<Size1, Type1> turnTo() const {PIMathVectorT<Size1, Type1> tv; uint sz = piMin<uint>(Size, Size1); for (uint i = 0; i < sz; ++i) tv[i] = c[i]; return tv;}
/**
* @brief Creates a vector each element of which is equal to value "v"
* @brief Creates a vector each element of which is equal to value "v"
*
* @param v this value fills the cells of the vector
* @return filled vector of type PIMathVectorT
@@ -581,11 +580,11 @@ public:
*/
PIMathVector(const _CVector & st, const _CVector & fn) {c.resize(st.size()); PIMV_FOR(i, 0) c[i] = fn[i] - st[i];}
/**
* @brief Method that returns the number of elements contained in the vector
*
* @return type uint shows number of elements in this vector
*/
/**
* @brief Method that returns the number of elements contained in the vector
*
* @return type uint shows number of elements in this vector
*/
uint size() const {return c.size();}
/**
@@ -593,7 +592,7 @@ public:
*
* @param size new vector dimension
* @param new_value value with which the vector is filled
* @return reference to this
* @return reference to this
*/
_CVector & resize(uint size, const Type & new_value = Type()) {c.resize(size, new_value); return *this;}
@@ -606,38 +605,38 @@ public:
*/
_CVector resized(uint size, const Type & new_value = Type()) {_CVector tv = _CVector(*this); tv.resize(size, new_value); return tv;}
/**
* @brief Method that set this elements to value "v"
*
* @param v value of which the vector is filled
* @return reference to this
*/
/**
* @brief Method that set this elements to value "v"
*
* @param v value of which the vector is filled
* @return reference to this
*/
_CVector & fill(const Type & v) {PIMV_FOR(i, 0) c[i] = v; return *this;}
/**
* @brief Method that sets this using a vector, each element of which is added to the value of "v"
*
* @param v value of which the vector is filled
* @return reference to this
*/
/**
* @brief Method that sets this using a vector, each element of which is added to the value of "v"
*
* @param v value of which the vector is filled
* @return reference to this
*/
_CVector & move(const Type & v) {PIMV_FOR(i, 0) c[i] += v; return *this;}
/**
* @brief Method that sets this with a vector, each element of which is added to each element of the vector "v".
* If the vectors have different dimensions, it returns this without changing anything
*
* @param v vector of type PIMathVectorT
* @return reference to this
*/
_CVector & move(const _CVector & v) {if(v.size() != c.size()) return *this; PIMV_FOR(i, 0) c[i] += v[i]; return *this;}
/**
* @brief Method that sets this with a vector, each element of which is added to each element of the vector "v".
* If the vectors have different dimensions, it returns this without changing anything
*
* @param v vector of type PIMathVectorT
* @return reference to this
*/
_CVector & move(const _CVector & v) {if(v.size() != c.size()) return *this; PIMV_FOR(i, 0) c[i] += v[i]; return *this;}
/**
* @brief Method that replaces two elements in this vector by indices. You cannot use an index larger than the number vector dimension,
* @brief Method that replaces two elements in this vector by indices. You cannot use an index larger than the number vector dimension,
* otherwise there will be "undefined behavior"
*
* @param fe index of the first element
* @param se index of the second element
* @return reference to this
* @return reference to this
*/
_CVector & swap(uint fe, uint se) {piSwap<Type>(c[fe], c[se]); return *this;}
@@ -648,11 +647,11 @@ public:
*/
Type lengthSqr() const {Type tv(0); PIMV_FOR(i, 0) tv += (c[i] * c[i]); return tv;}
/**
* @brief Method that returns a scalar physical value equal to the absolute value of vector
*
* @return value equal to length of a vector
*/
/**
* @brief Method that returns a scalar physical value equal to the absolute value of vector
*
* @return value equal to length of a vector
*/
Type length() const {return sqrt(lengthSqr());}
/**
@@ -663,48 +662,48 @@ public:
Type manhattanLength() const {Type tv(0); PIMV_FOR(i, 0) tv += fabs(c[i]); return tv;}
/**
* @brief Method that returns the cos of the current vector and vector "v". If the vectors have different dimensions, it returns false
* @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 PIMathVector
* @return cos value of the angle between two vectors
*/
Type angleCos(const _CVector & v) const {if(v.size() != c.size()) return false; Type tv = v.length() * length(); return (tv == Type(0) ? Type(0) : ((*this) ^ v) / tv);}
Type angleCos(const _CVector & v) const {if(v.size() != c.size()) return false; 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.
* If the vectors have different dimensions, it returns false
*
* @param v vector of type PIMathVector
* @return sin value of the angle between two vector
*/
Type angleSin(const _CVector & v) const {if(v.size() != c.size()) return false; Type tv = angleCos(v); return sqrt(Type(1) - tv * tv);}
Type angleSin(const _CVector & v) const {if(v.size() != c.size()) return false; 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.
* If the vectors have different dimensions, it returns false
*
* @param v vector of type PIMathVector
* @return value of the angle between two vectors in Rad
*/
Type angleRad(const _CVector & v) const {if(v.size() != c.size()) return false; return acos(angleCos(v));}
Type angleRad(const _CVector & v) const {if(v.size() != c.size()) return false; 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.
* If the vectors have different dimensions, it returns false
*
* @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() != c.size()) return false; return toDeg(acos(angleCos(v)));}
Type angleDeg(const _CVector & v) const {if(v.size() != c.size()) return false; return toDeg(acos(angleCos(v)));}
/**
* @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
* @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 PIMathVector
* @return vector of type PIMathVector equal to the projection of the current vector onto the vector "v"
*/
_CVector projection(const _CVector & v) {if(v.size() != c.size()) return *this; Type tv = v.length(); return (tv == Type(0) ? _CVector() : v * (((*this) ^ v) / tv));}
_CVector projection(const _CVector & v) {if(v.size() != c.size()) return *this; Type tv = v.length(); return (tv == Type(0) ? _CVector() : v * (((*this) ^ v) / tv));}
/**
* @brief Method that returns a normalized vector
@@ -735,13 +734,13 @@ public:
bool isValid() const {return !c.isEmpty();}
/**
* @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".
* If the vectors have different dimensions, it returns false
*
* @param v vector of type PIMathVector
* @return true if vectors are orthogonal, else false
*/
bool isOrtho(const _CVector & v) const {if(v.size() != c.size()) return false; return ((*this) ^ v) == Type(0);}
bool isOrtho(const _CVector & v) const {if(v.size() != c.size()) return false; return ((*this) ^ v) == Type(0);}
/**
* @brief Read-only access to elements reference by index of the vector element "index"
@@ -766,22 +765,22 @@ public:
* @param index is the index of necessary element
* @return element of vector
*/
const Type & operator [](uint index) const {return c[index];}
const Type & operator [](uint index) const {return c[index];}
/**
* @brief Vector assignment to vector "v" of type PIMathVector
* If the vectors have different dimensions, it returns this without changing anything
* If the vectors have different dimensions, it returns this without changing anything
*
* @param v vector for the assigment
* @return reference to this
* @return reference to this
*/
_CVector & operator =(const _CVector & v) {if(v.size() != c.size()) return *this; c = v.c; return *this;}
_CVector & operator =(const _CVector & v) {if(v.size() != c.size()) return *this; c = v.c; return *this;}
/**
* @brief Vector assignment to value "v"
*
* @param v value for the assigment
* @return reference to this
* @return reference to this
*/
_CVector & operator =(const Type & v) {PIMV_FOR(i, 0) c[i] = v; return *this;}
@@ -791,7 +790,7 @@ public:
* @param v vector for the compare
* @return if vectors are equal true, else false
*/
bool operator ==(const _CVector & v) const {PIMV_FOR(i, 0) if ((c[i] != v[i]) || (v.size() != c.size())) return false; return true;}
bool operator ==(const _CVector & v) const {PIMV_FOR(i, 0) if ((c[i] != v[i]) || (v.size() != c.size())) return false; return true;}
/**
* @brief Compare with vector "v"
@@ -802,72 +801,72 @@ public:
bool operator !=(const _CVector & v) const {return !(*this == v);}
/**
* @brief Addition assignment this vector with vector "v". If the vectors have different dimensions, it returns void()
* @brief Addition assignment this vector with vector "v". If the vectors have different dimensions, it returns void()
*
* @param v vector for the addition assigment
*/
void operator +=(const _CVector & v) {if(v.size() != c.size()) return void(); PIMV_FOR(i, 0) c[i] += v[i];}
void operator +=(const _CVector & v) {if(v.size() != c.size()) return void(); PIMV_FOR(i, 0) c[i] += v[i];}
/**
* @brief Subtraction assignment this vector with vector "v". If the vectors have different dimensions, it returns void()
* @brief Subtraction assignment this vector with vector "v". If the vectors have different dimensions, it returns void()
*
* @param v vector for the subtraction assigment
*/
void operator -=(const _CVector & v) {if(v.size() != c.size()) return void(); PIMV_FOR(i, 0) c[i] -= v[i];}
void operator -=(const _CVector & v) {if(v.size() != c.size()) return void(); PIMV_FOR(i, 0) c[i] -= v[i];}
/**
* @brief Multiplication assignment this vector with value "v"
* @brief Multiplication assignment this vector with value "v"
*
* @param v value for the multiplication assigment
*/
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". If the vectors have different dimensions, it returns void()
*
* @param v vector for the multiplication assigment
*/
void operator *=(const _CVector & v) {if(v.size() != c.size()) return void(); PIMV_FOR(i, 0) c[i] *= v[i];}
void operator *=(const _CVector & v) {if(v.size() != c.size()) return void(); PIMV_FOR(i, 0) c[i] *= v[i];}
/**
* @brief Division assignment this vector with value "v"
* @brief Division assignment this vector with value "v"
*
* @param v value for the division assigment
*/
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". If the vectors have different dimensions, it returns void()
*
* @param v vector for the division assigment
*/
void operator /=(const _CVector & v) {if(v.size() != c.size()) return void(); PIMV_FOR(i, 0) c[i] /= v[i];}
void operator /=(const _CVector & v) {if(v.size() != c.size()) return void(); PIMV_FOR(i, 0) c[i] /= v[i];}
/**
* @brief Vector substraction this vector
* @brief Vector substraction this vector
*
* @return the result of vector substraction
*/
_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". If the vectors have different dimensions, it returns this without changing anything
*
* @param v is vector term
* @param v is vector term
* @return the result of matrix addition
*/
_CVector operator +(const _CVector & v) const {if(v.size() != c.size()) return _CVector(*this); _CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] += v[i]; return tv;}
_CVector operator +(const _CVector & v) const {if(v.size() != c.size()) return _CVector(*this); _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". If the vectors have different dimensions, it returns this without changing anything
*
* @param v is vector term
* @param v is vector term
* @return the result of vector substraction
*/
_CVector operator -(const _CVector & v) const {if(v.size() != c.size()) return _CVector(*this); _CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] -= v[i]; return tv;}
_CVector operator -(const _CVector & v) const {if(v.size() != c.size()) return _CVector(*this); _CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] -= v[i]; return tv;}
/**
* @brief Vector multiplicationthis vector with value "v"
* @brief Vector multiplicationthis vector with value "v"
*
* @param v is value factor
* @return the result of vector multiplication
@@ -875,7 +874,7 @@ 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 value "v"
* @brief Vector division this vector with value "v"
*
* @param v is value divider
* @return the result of vector division
@@ -888,23 +887,23 @@ public:
* @param v is vector for cross product
* @return the result vector equal of cross product
*/
_CVector operator *(const _CVector & v) const {if ((c.size() != 3) || (v.size() != 3)) return _CVector(); _CVector tv(3); 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;}
_CVector operator *(const _CVector & v) const {if ((c.size() != 3) || (v.size() != 3)) return _CVector(); _CVector tv(3); 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. If the vectors have different dimensions, it returns this without changing anything
*
* @param v is vector for multiplication
* @return resulting vector
*/
_CVector operator &(const _CVector & v) const {if(v.size() != c.size()) return _CVector(*this); _CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] *= v[i]; return tv;}
_CVector operator &(const _CVector & v) const {if(v.size() != c.size()) return _CVector(*this); _CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] *= v[i]; return tv;}
/**
* @brief Value of the dot product. If the vectors have different dimensions, it returns false
* @brief Value of the dot product. If the vectors have different dimensions, it returns false
*
* @param v is vector for dot product
* @return resulting value
* @return resulting value
*/
Type operator ^(const _CVector & v) const {if(v.size() != c.size()) return false; Type tv(0); PIMV_FOR(i, 0) tv += c[i] * v[i]; return tv;}
Type operator ^(const _CVector & v) const {if(v.size() != c.size()) return false; Type tv(0); PIMV_FOR(i, 0) tv += c[i] * v[i]; return tv;}
/**
* @brief Converts PIMathVector to PIVector type