I have a magnitude of the vector pointing somewhere in 3D space from the origin (0x, 0y, 0z). I also have an angle that projection of the vector in X and Z axis makes between itself and the Y axis. In other words I have a joystick that reads X angle (from -35 to 35 degrees) for left-right movement and Z angle (from -35 to 35 degrees) for front-back movement. It returns 0 when joystick is is in its initial position. I get a reading of magnitude (how far the string is pulled out from the joystick). I need to find the coordinates (assuming 1 cm of magnitude is equal to a unit vector) of the point at the end of the string. Point will always locate above x-z axis plane. Magnitude is never 0.
I would appreciate an algorithm or a piece of code on Java, even though a link to extra materials will be good too. There are Q&A talking about rotational angles and matrix, but it looks like I have a different problem.
UPD: Angles are not between the vector and x,y,z axis. They are angles that projection of the vector onto axis makes with Y-axis.
UPD1: Joystick can be moved right-left and front-back:
+z
|
-x -- -- +x -x --'-- +x
|
-z
Top view Side view (along z-axis)
As well as having an extendable string in the middle (s):
+z +s (+y)
| |
-x -- -- +x -x --'-- +x
|
-z
Top view Side view (along z-axis)
When string is extended a point (P) in 3D is formed
+z +y +y
| P | P | P
|/ | / | /
-x --/-- +x |/ |/
| -x --'-- +x -z --'-- +z
-z
Top view Side view Side view
(along z-axis) (along x-axis)
I receive coordinates in the following format:
- x-axis angle (call it alpha) [-1 1] in reality between [-35 and 35] degrees
- y-axis angle (call it theta) [-1 1] in reality between [-35 and 35] degrees
- magnitude of vector OP (call it magnitude) [-1 1] in reality between 0[ and 305] cm