git-svn-id: svn://db.shs.com.ru/pip@203 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2016-05-27 09:42:38 +00:00
parent 8512f6c66f
commit 5cad2d85db
2 changed files with 5 additions and 4 deletions

View File

@@ -4,7 +4,7 @@
/*
PIP - Platform Independent Primitives
PIMathMatrix
Copyright (C) 2016 Ivan Pelipenko peri4ko@gmail.com
Copyright (C) 2016 Ivan Pelipenko peri4ko@gmail.com, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -48,6 +48,7 @@ public:
//PIMathMatrixT(const _CMatrix & o) {resize(Rows, Cols); int i = 0; PIMM_FOR_I_WB(r, c) m[r][c] = val[i++];}
static _CMatrix identity() {_CMatrix tm = _CMatrix(); PIMM_FOR_WB(r, c) tm.m[r][c] = (c == r ? Type(1) : Type(0)); return tm;}
static _CMatrix filled(const Type & v) {_CMatrix tm; PIMM_FOR_WB(r, c) tm.m[r][c] = v; return tm;}
static _CMatrix rotation(double angle) {return _CMatrix();}
static _CMatrix rotationX(double angle) {return _CMatrix();}
static _CMatrix rotationY(double angle) {return _CMatrix();}
@@ -75,7 +76,7 @@ public:
Type at(uint row, uint col) const {return m[row][col];}
Type * operator [](uint row) {return m[row];}
const Type * operator [](uint row) const {return m[row];}
void operator =(const _CMatrix & sm) {memcpy(m, sm.m, sizeof(Type) * Cols * Rows);}
_CMatrix & operator =(const _CMatrix & sm) {memcpy(m, sm.m, sizeof(Type) * Cols * Rows); return *this;}
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 {return !(*this == sm);}
void operator +=(const _CMatrix & sm) {PIMM_FOR_WB(r, c) m[r][c] += sm.m[r][c];}

View File

@@ -4,7 +4,7 @@
/*
PIP - Platform Independent Primitives
PIMathVector
Copyright (C) 2016 Ivan Pelipenko peri4ko@gmail.com
Copyright (C) 2016 Ivan Pelipenko peri4ko@gmail.com, Andrey Bychkov work.a.b@yandex.ru
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -87,7 +87,7 @@ public:
_CVector operator *(const Type & v) const {_CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] *= v; return tv;}
_CVector operator /(const Type & v) const {_CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] /= v; return tv;}
_CVector operator /(const _CVector & v) const {_CVector tv = _CVector(*this); PIMV_FOR(i, 0) tv[i] /= v[i]; return tv;}
_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;}
_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;}
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 {