Different way to do 3d rotations?
I''ve been fooling around trying to learn linear algebra so I can understand transformations that do the rotations of an object, now I actually didn''t learn much about it yet.. the book I have is my physics teacher''s, it''s way old. But I got to thinking about it and thought I might be able to solve my problem with spherical coordinates. Anyway to make a long story short I threw together a simple program in java that handle rotating and object by sending it angles then just doing some simple conversions. Courtesy of some very easy to understand calc 2 stuff. My program worked with only one logical error that I am working on fixing. As far as I can tell if optimized there might also be a speed increase in calculations(but only if you have many objects being manipulated). Anyway I was just wondering has anyone ever tried making a 3d engine that performs rotations this way? It''s very very easy to understand doing it this way than to do the complex matrix math I''ve seen used commonly for rotations.
Not sure if I really understand what it is that you''re doing, but it sound like you''re using quaternions. You can read about them in the resource section here at GameDev.net.
It sounds like you haven''t implemented rotations around arbitrary axises yet. In that case rotating by Matrices in normal rectangular coordinates is far superior in terms of performance as well as mathematical clarity. Translations by fixed rectangular amounts are also vaguely painful in spherical coordinates in terms of computation time.
Sounds like you''re using a modified Control Cubes method. I read about the method first on Gamedev.net so the file will be lurking around somewhere. Basically, it uses rectangular co-ordinates but does away with much of the matrix math.
=> Arfa <=
=> Arfa <=
=> Arfa <=
no I''m not using quaternions, as far as I know.
SiCrane: Yeah I haven''t tried it using an abritrary axis.. Do you happen to know by chance how much of a loss I will take by diong the shperical coordinate conversion?
Afra: do you happen to konw where that article is? I''ve heard people mention something about it when I was going through the post for like the last year or so but I''m not sure what''s about.. The post I read said that it was on gamasutra.com but I scoured that site and couldn''t find it.
SiCrane: Yeah I haven''t tried it using an abritrary axis.. Do you happen to know by chance how much of a loss I will take by diong the shperical coordinate conversion?
Afra: do you happen to konw where that article is? I''ve heard people mention something about it when I was going through the post for like the last year or so but I''m not sure what''s about.. The post I read said that it was on gamasutra.com but I scoured that site and couldn''t find it.
Translations require at least two sins and arcsins per point translated. For a simple object, say a cube, that''s 8 arcsins in a single translation. For rotation around an arbitrary axis, you translate the object to be rotated so that the axis passes through the origin, rotate and then translate back. All in all very computationally expensive in spherical. In matrix transformations, you apply the same transformation matrix to each point. In your spherical transformation you''d have to calculate the translations, rotations and retranslations separately for each point.
True, but using lookup tables for sin and cos, make it only 2 arcsin per cyc(but I'm working on a workaround for that).. the rest is just multiplication and divisions... Which is the same as doing it with matices.... infact I think it might be close to the same about of work on the cpu, I guess I'll really have to compare code to be certain though.. the pocedure I used was to draw object in cartesian, convert to spherical and and the degree of the angles you wish to rotate and then convert back..
Edited by - Wrathnut on 2/12/00 7:52:37 PM
Edited by - Wrathnut on 2/12/00 7:52:37 PM
In order to keep it on the same order of magnitude for computation time you''ll need look-up tables for both the sins and arcsins. You''ll have problems with granularity in your tables, especially as you move farther away from the origin. Bottom line is that lookup tables aren''t accurate enough for the general case.
^_^ I''ll take your word SiCrane. I think I''m still going to play around with it till I get the DirectX docs figured though! heheh
You don''t have to take my word for it. Just think what happens when you try to translate an object 1000 units away from the origin by 1 unit. You''ll need an angle of 0.05729 in your arcsin lookup. Even if you only do multiples of 0.05 that 7200 entries in your lookup table. Then consider that you won''t hit 0.05729 exactly, you''ll be off by 0.00729. You can solve that by interpolating between lookup table values, but then you''ve increased the time complexity of calculation again. The alternative is to increase the granularity of your table until it can handle the 0.057, in which case you''ll probably need a lookup table size of 360,000 entries. If your use 32bit values for your tables then that 1,440,000 bytes in your lookup table. Then you start really having troubles with cache misses, page faults, etc. And you''re still not as accurate as rectangular coordinates with matrix transforms.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement