Advertisement

Sum of squares

Started by November 29, 2002 05:14 PM
2 comments, last by Ataru 22 years, 2 months ago
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
Advertisement
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



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 Moderator, Math & Physics forum @ gamedev.net

This topic is closed to new replies.

Advertisement