Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
pr0fess0r cha0s
16
Years of Service
User Offline
Joined: 6th Oct 2008
Location:
Posted: 25th Apr 2009 07:30
I have noticed strange angles in Dark Basic. The coordinate system seems to be off. I have a program that rotates a cube and displays the angle it is facing. If graphed on a coordinate plain, the top terminal is 0 instead of 90. The next clockwise is 90 instead of zero. The next is 180 instead of 270, the next 270 instead of 180. I need to use trig functions sin, cos, tan, arc sin, arc cos, arc tan. It doesn't seem to work in my program. Has anyone else run into this problem? Am I missing something?
That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 25th Apr 2009 07:39
so ur sayin when looking at a birds eye view of the 3d world, north is 0, east is 90 etc

yes, the 3d angles system starts/ends at straight up on the z axis

what are you trying to get the trig functions to do, perhaps attach some code

There are only 10 kinds of people in the world, those who understand binary and those who dont
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 25th Apr 2009 11:49 Edited at: 2nd Aug 2009 22:33
@porfessor chaos

There's a 2d cartesian coordinate system in which 0 degrees is (1,0), 90 is (0,1) 180 is (-1,0) and 270 is (0,-1)

There's the 3d coordinate system that's a little bit different. If we look at the angles opening from 0 to 90 between axes, we have to look at each axis in it's + direction and in order.

So starting with +x in relation to +y, if you are looking straight into the screen, that's the right hand side moving towards the top of the screen. 0 to 90 from +x to +y would be a counter clockwise rotation, just like the 2d coordinate system. That is a rotation around the z axis so we'll consider it a z angle rotation.

Now let's look at +y to +z. Starting from the top of the screen (the y axis), you rotate forward into the screen (the z axis). 0 to 90 from +y to +z is a forward rotation into the screen from top to middle. That's a rotation around the x axis so that would be an xangle rotation.

So the last rotation is from +z and the only axis left is +x (starting over). That's from into the screen then moving to the right. If we looked down at from a birds eye view, that would be a clockwise rotation and opposite to what you'd expect like you describe in your post. So from 0 to 90 from +z to +x is a rotation from the middle to the right. That's a rotation around the y axis, so that is a y angle rotation.

Sin, cos, tan, all work fine. You just have to be sure about the relationship of the values you are supplying.

If you want the 3d angle between two points on the x & z plane for example, remember that the positive direction of the angle between these two axes is clockwise (or a y angle rotation to the right). If the first coordinate is (0,0,0) and the second coordinate is (10,0,5), then the yangle is

or the faster way is


Understand the difference between the 3d and the 2d?

Enjoy your day.
Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 25th Apr 2009 11:55
You don't need to post the same thread in four different boards!

That1Smart Guy
16
Years of Service
User Offline
Joined: 26th Feb 2009
Location: Somewhere...... yep
Posted: 25th Apr 2009 18:10
o relax digg, he just wants an answer, no big deal

There are only 10 kinds of people in the world, those who understand binary and those who dont
pr0fess0r cha0s
16
Years of Service
User Offline
Joined: 6th Oct 2008
Location:
Posted: 26th Apr 2009 01:10
Sorry for posting it too many times. However, thanks to latch I got a really good answer.

Login to post a reply

Server time is: 2025-06-08 05:29:15
Your offset time is: 2025-06-08 05:29:15