Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Become a Premium Member and unlock a new, free course in leading technologies each month.

Solved

Posted on 2005-03-01

I am writing a graphics program in C++ utilizing openGL. It is the typical "solar system" exercise where I have a central object (the sun) rotating on its axis and 2 planets orbiting the sun rotating on their axis'. The viewer (camera) is on a satellite that is in the outermost orbit of the solar system so that all objects are visible at the same time. The satellite can move either direction in its orbit. (orbit to the right, orbit to the left). The satellite can rotate on its own axis while always facing the sun. In other words the "up" direction can change simultaneously while orbiting the sun. How do I calculate the vector for the "UP" position given an angle of rotation and the current x, y coordinates. Specifically, how do I calculate the z coordinate with respect to x, y, theta? ("up" is defined as the reference vector in which you perceive "up" to be. If I tilt my head 45 degrees to the right, up for me would be the vector (1, 1))

For Example:

Satelite is located at (0, 0, 1) facing the origin. The normal up vector would be (0, 1, 0)(WRT the origin translated to the satellite) or (cos(theta)*r, sin(theta)*r, 0.0). If I rotate the "up" position by 45 degrees (rotate the satellite axis by 45 degrees) this formula works fine as long as I'm stationary at location (0, 0, 1). If I move the satellite to position (cos(60), 0.0, sin(60)) in the satellite orbit and I want to rotate the satellite on its axis by 45 degrees (while always facing the origin), the z coordinate changes also. How do I calculate the (x, y, z) coordinates for my up position as I orbit about the origin on the plane x = 0??

For Example:

Satelite is located at (0, 0, 1) facing the origin. The normal up vector would be (0, 1, 0)(WRT the origin translated to the satellite) or (cos(theta)*r, sin(theta)*r, 0.0). If I rotate the "up" position by 45 degrees (rotate the satellite axis by 45 degrees) this formula works fine as long as I'm stationary at location (0, 0, 1). If I move the satellite to position (cos(60), 0.0, sin(60)) in the satellite orbit and I want to rotate the satellite on its axis by 45 degrees (while always facing the origin), the z coordinate changes also. How do I calculate the (x, y, z) coordinates for my up position as I orbit about the origin on the plane x = 0??

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

- Help others & share knowledge
- Earn cash & points
- Learn & ask questions

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Course of the Month11 days, 13 hours left to enroll

Join the community of 500,000 technology professionals and ask your questions.