-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Function to convert vector dir and up to #1352
Comments
https://gist.github.com/commy2/d60b11fd38cf53f5c2ec02cda0dc3426 I never included it, because apparently BI made/was about to make their own function. |
I don't think you got _bank right. |
I was thinking someone must've done this before, but I couldn't find the right place to ask. |
The question of the bank is explained by this page https://en.wikipedia.org/wiki/Inverse_trigonometric_functions#Relationships_among_the_inverse_trigonometric_functions You will see that your function uses asin, but as an encoding by atan2. |
As a note on a complement function, there is information here about constructing a rotation matrix from Tait-Bryan angles, which should correspond to the system that 3den uses. |
Let:
You have: arcsin x https://www.wolframalpha.com/input/?i=arcsin+x I have: arctan [(-x) / sqrt (1 - x²)] https://www.wolframalpha.com/input/?i=arctan+%5B%28-x%29+%2F+sqrt+%281+-+x%C2%B2%29%5D |
You can plot them into wolfram alpha as an equation and see that they're (nearly) equivalent. If you remove a minus, like it's written on wikipedia, they are exactly equivalent. As for why NASA decided to do it that way? Well, Wikipedia says: |
Here's the proof of concept for a complementary function from 3DEN rotation angles to vector dir and up. fnc_convert3DENRotationToVectorDirAndUp = {
params["_rotation"];
_rotation params ["_rotX", "_rotY", "_rotZ"];
_vectorDirAndUp = [
[
(cos _rotY) * (sin _rotZ),
(cos _rotX)*(cos _rotZ)+(sin _rotX)*(sin _rotY)*(sin _rotZ),
-(sin _rotX)*(cos _rotZ)+(cos _rotX)*(sin _rotY)*(sin _rotZ)
],
[
-sin _rotY,
(sin _rotX)*(cos _rotY),
(cos _rotX)*(cos _rotY)
]
];
_vectorDirAndUp
}; |
Do we have the reverse? |
Which do you mean? |
Ah, I see. Missed the "complementary". That solves it then. |
In my own project I needed a way to convert vectorDir and vectorUp into rotations that are compatible with the rotation attribute in eden. I could not find a solution so I made my own function.
The output is consistent with
I figured this function could be useful for other people, so I've suggested it here.
It is similar to getPitchBank in that it gives an array of degrees of rotation, but the difference is that this function is consistent with the representation 3den uses.
I don't know a suitable name for this, so feel free to suggest a fitting one.
A complementary function from 3den rotation to vectorDir and vectorUp would be fitting, but I'm not sure how that would look yet.
The text was updated successfully, but these errors were encountered: