jacobienne
This commit is contained in:
parent
f41b71588f
commit
caf83ef7ca
|
@ -318,6 +318,28 @@ namespace gti320 {
|
|||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Opérateur de d'addition d'une autre matrice
|
||||
*
|
||||
* Ajoute toutes les entrées de la matrice dans la sous-matrice.
|
||||
*
|
||||
* Note : la taille de la matrice doit correspondre à la taille de la
|
||||
* sous-matrice.
|
||||
*/
|
||||
template<typename _OtherScalar, int _OtherRows, int _OtherCols, int _OtherStorage>
|
||||
SubMatrix &operator+=(const Matrix<_OtherScalar, _OtherRows, _OtherCols, _OtherStorage> &matrix) {
|
||||
assert(this->rows() == matrix.rows());
|
||||
assert(this->cols() == matrix.cols());
|
||||
|
||||
for (int col = 0; col < this->cols(); col++) {
|
||||
for (int row = 0; row < this->rows(); row++) {
|
||||
(*this)(row, col) = (*this)(row, col) + matrix(row, col);
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accesseur aux entrées de la sous-matrice (lecture seule)
|
||||
*
|
||||
|
|
|
@ -145,9 +145,9 @@ void ParticleSystem::buildDfDx(Matrix<float, Dynamic, Dynamic> &dfdx) {
|
|||
|
||||
Matrix<float, 2, 2> ndiag = -1.0f * diag;
|
||||
|
||||
dfdx.block(spring.index0, spring.index1, 2, 2) = diag;
|
||||
dfdx.block(spring.index0 + 2, spring.index1 + 2, 2, 2) = diag;
|
||||
dfdx.block(spring.index0 + 2, spring.index1, 2, 2) = ndiag;
|
||||
dfdx.block(spring.index0, spring.index1 + 2, 2, 2) = ndiag;
|
||||
dfdx.block(spring.index0, spring.index1, 2, 2) += diag;
|
||||
dfdx.block(spring.index0 + 2, spring.index1 + 2, 2, 2) += diag;
|
||||
dfdx.block(spring.index0 + 2, spring.index1, 2, 2) += ndiag;
|
||||
dfdx.block(spring.index0, spring.index1 + 2, 2, 2) += ndiag;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue