pimathvector.h mul

This commit is contained in:
2020-10-21 18:36:57 +03:00
parent 7b5555f63d
commit 6f3fdf4d49
2 changed files with 52 additions and 7 deletions

View File

@@ -149,6 +149,14 @@ public:
PIMV_FOR tv += c[i] * v[i];
return tv;
}
_CVector mul(const _CVector & v) const {
_CVector tv(*this);
PIMV_FOR tv[i] *= v[i];
return tv;
}
_CVector mul(const Type & v) const {
return (*this) * v;
}
PIMathMatrixT<1, Size, Type> transposed() const {
PIMathMatrixT<1, Size, Type> ret;
@@ -172,6 +180,22 @@ public:
return tv;
}
static _CVector cross(const _CVector & v1, const _CVector & v2) {
return v1.cross(v2);
}
static _CVector dot(const _CVector & v1, const _CVector & v2) {
return v1.dot(v2);
}
static _CVector mul(const _CVector & v1, const _CVector & v2) {
return v1.mul(v2);
}
static _CVector mul(const Type & v1, const _CVector & v2) {
return v2 * v1;
}
static _CVector mul(const _CVector & v1, const Type & v2) {
return v1 * v2;
}
private:
Type c[Size];
@@ -372,6 +396,15 @@ public:
PIMV_FOR tv += c[i] * v[i];
return tv;
}
_CVector mul(const _CVector & v) const {
assert(c.size() == v.size());
_CVector tv(*this);
PIMV_FOR tv[i] *= v[i];
return tv;
}
_CVector mul(const Type & v) const {
return (*this) * v;
}
Type distToLine(const _CVector & lp0, const _CVector & lp1) {
assert(c.size() == lp0.size());
@@ -388,9 +421,24 @@ public:
inline Type * data() {return c.data();}
inline const Type * data() const {return c.data();}
static _CVector cross(const _CVector & v1, const _CVector & v2) {
return v1.cross(v2);
}
static _CVector dot(const _CVector & v1, const _CVector & v2) {
return v1.dot(v2);
}
static _CVector mul(const _CVector & v1, const _CVector & v2) {
return v1.mul(v2);
}
static _CVector mul(const Type & v1, const _CVector & v2) {
return v2 * v1;
}
static _CVector mul(const _CVector & v1, const Type & v2) {
return v1 * v2;
}
private:
PIVector<Type> c;
};
template<typename Type>