Sum of squares
Anyone know of a method to normalize a matrix by the sum of squares?
I.E you''re given a matrix and if you sum all the squares they equal 1.
At first I though this would be simple to do, but I couldn''t figure it out, and can''t seem to find anything about how to do it, on-line.
I''m not sure that I understand what you mean.
Even if I did, you should not post homework questions in this forum.
Cédric
Even if I did, you should not post homework questions in this forum.
Cédric
If I understand your question correctly, you normalize a matrix the same way you normalize everything else, ie. divide every element by the magnitude. Ex:
matrix=
[m11, m12, m13]
[m21, m22, m23]
magnitude= sqrt(m11^2+m12^2+m13^2+m21^2+m22^2+m23^2)
normalized_matrix=
[m11 / magnitude, m12 / magnitude, m13 / magnitude]
[m21 / magnitude, m22 / magnitude, m23 / magnitude]
test:
m11^2+m12^2+m13^2+m21^2+m22^2+m23^2 == 1
Hope that helps!
Spartacus
matrix=
[m11, m12, m13]
[m21, m22, m23]
magnitude= sqrt(m11^2+m12^2+m13^2+m21^2+m22^2+m23^2)
normalized_matrix=
[m11 / magnitude, m12 / magnitude, m13 / magnitude]
[m21 / magnitude, m22 / magnitude, m23 / magnitude]
test:
m11^2+m12^2+m13^2+m21^2+m22^2+m23^2 == 1
Hope that helps!
Spartacus
Real programmers don''t document, if it was hard to write it should be hard to understand
Real programmers don't document, if it was hard to write it should be hard to understand
I don''t feel this is a homework question (though it might be). But if you are trying to normalize the matrix for game math, I wonder if you''re trying to do the wrong thing?
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes
Senior Scientist
Applied Research Associates, Inc.
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement