Getting position after transformation without drawing?
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).
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).
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 recast 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 reimplementing the code I posted for objectivec.
I'm not experienced enough with objectivec to help you out much more than that unfortunately...
I'm not experienced enough with objectivec to help you out much more than that unfortunately...
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 kberg.
Edit: kEarthTilt was 23.5, not 23.5. Sorry.
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 kberg.
Edit: kEarthTilt was 23.5, not 23.5. Sorry.
Glad to see you managed to solve it. Keep up the good work!
 Sohta
Possibly Related Threads...
Thread:  Author  Replies:  Views:  Last Post  
SDL. Current music position  e40pud  0  2,856 
Mar 9, 2010 08:46 AM Last Post: e40pud 

New to OpenGL  Transformation Help  Dash Rantic  4  3,805 
Mar 9, 2008 06:08 PM Last Post: Dash Rantic 

Transformation from unit cube to view frustum  TomorrowPlusX  10  7,907 
Jul 12, 2005 11:32 AM Last Post: TomorrowPlusX 

Object position after rotation  charon  11  8,529 
Mar 2, 2005 11:33 AM Last Post: hangt5 

Put a Autocam in Top Position  alert  5  4,777 
Dec 15, 2004 05:37 AM Last Post: Fenris 