Getting position after transformation without drawing?

hyn
Unregistered
 
Post: #16
I'm still tackling this problem.
It's been days and I can't find the source of inacuracy.

My coordinates before passing them in the rotate function is absolutely correct, because when I plot it on the sphere, it's at the right spot. When the value of rotations are 0.0, the position is correct. But when you rotate it about the X or Y axis, it rotates in excess not in the direction it's rotating, but about an arbitrary axis.

Since my input to the matrix functions is valid, the problem must be in my implementation of kberg's code. His code must be right because he obviously uses it.
The only difference between his and my code is the use of sin cos sqrt as opposed to sinf cosf sqrtf. Where can I find these functions? They aren't defined in math.h or float.h in my implementation (Mac OS X.3.4 with Xcode 1.1).
Quote this message in a reply
kberg
Unregistered
 
Post: #17
Don't worry about the sinf, etc, trig functions. All they do is return floats instead of doubles (for efficiency only). If I were to switch all my code from cosf, sinf calls to cos and sin, it would still function correctly (though C++ would implicitly re-cast the returned results as floats). Your problem most likely lies with incorrect order of transformations, or something as silly as a typo if you are re-implementing the code I posted for objective-c.

I'm not experienced enough with objective-c to help you out much more than that unfortunately...
Quote this message in a reply
hyn
Unregistered
 
Post: #18
Oh my god.
It WAS the order of rotations!
As to why this matters I cannot understand.
I eliminated rotation about the z axis (tilt), and did X axis rotation first then Y.
This particular order works, but any other combinations don't.
Why can't I incorporate rotation about the Z axis without messing up the rotations?

I Love kberg.

Edit: kEarthTilt was -23.5, not 23.5. Sorry.
Quote this message in a reply
Member
Posts: 72
Joined: 2006.10
Post: #19
Glad to see you managed to solve it. Keep up the good work!

- Sohta
Quote this message in a reply
kberg
Unregistered
 
Post: #20
Cool, glad it worked! Smile
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  SDL. Current music position e40pud 0 2,205 Mar 9, 2010 08:46 AM
Last Post: e40pud
  New to OpenGL -- Transformation Help Dash Rantic 4 3,042 Mar 9, 2008 06:08 PM
Last Post: Dash Rantic
  Transformation from unit cube to view frustum TomorrowPlusX 10 6,333 Jul 12, 2005 11:32 AM
Last Post: TomorrowPlusX
  Object position after rotation charon 11 6,597 Mar 2, 2005 11:33 AM
Last Post: hangt5
  Put a Auto-cam in Top Position alert 5 3,941 Dec 15, 2004 05:37 AM
Last Post: Fenris