My first Matrix
I''m attempting to get my matrix class to work but there I''ve made some error somewhere that makes the matrix squash when its rotated a second time.
I''ve put together my matrix class along with a test application that demonstrates the problem
It''s here:
http:\\members.pnc.com.au\~gimp\GraphicsLibrary Test.zip
and it''s only 7kb
I''d appreciate it VERY much if someone could have a quick look and help me out. I''ve reduced the problem to a very small subset of my code and included a fairly clear example showing what doesn''t work.
Thankyou very much in advance for ANY help you can provide on the reason for this problem.
Chris
Chris Brodie
Make sure you normalize the matrix after rotating, and make sure that it is initialized correctly for affine space
1000
0100
0010
000(0/1)
(Vector/Point)
Also, you have to multiple the matrices in the opposite order that they apply in... pushmatrix, loadmatrix, mutlimatrix doesn''t work.
You have to copy the current matrix, loadmatrix(newrotation) pushmatrix, loadmatrix(''current matrix''), matrixmult.
1000
0100
0010
000(0/1)
(Vector/Point)
Also, you have to multiple the matrices in the opposite order that they apply in... pushmatrix, loadmatrix, mutlimatrix doesn''t work.
You have to copy the current matrix, loadmatrix(newrotation) pushmatrix, loadmatrix(''current matrix''), matrixmult.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
I''m sorry, I didn''t get that...
I thought that Load matrix replaces the current matrix and Pushmatrix makes a new copy of the current matrix on the stack and multmatrix multiplies your matrix by the current matrix
So, when you call push you get a new matrix, you multiply that by my matrix to get the new position\orientation, draw then pop that new location...
My app seems to work as far as positioning\rotation goes except when you use a few rotations.
Why is what I''m doing wrong?
Many thanks
Chris
I thought that Load matrix replaces the current matrix and Pushmatrix makes a new copy of the current matrix on the stack and multmatrix multiplies your matrix by the current matrix
So, when you call push you get a new matrix, you multiply that by my matrix to get the new position\orientation, draw then pop that new location...
My app seems to work as far as positioning\rotation goes except when you use a few rotations.
Why is what I''m doing wrong?
Many thanks
Chris
Chris Brodie
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement