I am trying to implement soft body physics, based on this paper by Müller et al.. I'm not terribly bad at mathematics, but while implementing formula (7) I just can't figure out the semantics.
It goes like this:
A = \left( \sum_i m_i p_i q_i^T) \right) \left( \sum_i m_i q_i q_i^T \right)^{-1}
with q_i and p_i being vectors (from center of mass current position,
to be exact)
(please excuse my TeX). This does not make sense to me - a product of sums of vector products should give a scalar, but the result is treated as if it were a matrix.
Implementing the formula straightforward in clojure (core.matrix) gives me scalar results.
I tried to modify the implementation, replacing the N-vectors p and q with NxN matrices of zeroes and p and q as respetive first row/column. This gave me matrix results, but the resulting transformation makes my coordinates run away from the original positions errantly.
Does anybody have experience with this algorithm?
It's the implementation of clojure.core.matrix, that caused the problem. Usually the product of a column vector and a row vector should result in a matrix (while the product of row vector and a column vector result in a scalar).
The core.matrix returns scalars in both cases, although its api documentation states otherwise. So I had to extend the trick of forcing the multiplication: