## 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).
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...
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 kberg.

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

- Sohta
kberg
Unregistered

Post: #20