-
Notifications
You must be signed in to change notification settings - Fork 228
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
Added :inverse detailed section #794
Conversation
(with the correct definition this time) #652
:access: Get only | ||
|
||
:struct: Gives a `Direction` with the opposite rotation around its axes. So `r(30,15,5)` becomes `r(-30,-15,-5)`. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this true? I was unsure. (remembering of course, that if it says, say, 330 that does mean -30 - I think Rots get printed clamped into the 0-360 range so you never see negative numbers when you print them (i.e. -10 prints as +350).)
but I don't remember if this is really true - has this claim been tested?
(One of the reasons I find it takes a while to do the docs is I often run into stuff I'm not confident about and have to fire up KSP to type it out and give it a try.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't test whether Rots ever get printed as negative but i did test it accepting those rotations. Have just done more testing on them and using vang
there is a 0.5deg (might be floating point error - might not) between r(30,15,5):inverse:vector
and r(-30,-15,5):vector
. There is also a similar difference between them and r(330,345,355):vector
.
Also print r(30,15,5):inverse.
gives R(329.756,345.538,2.968)
the first 2 are close enough that i just assumed floating point but the 2.968
makes me uncertain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The best test to be sure is to print them from a ship in orbit, time warp about 1/4 of the way around the planet, and try again. That will ensure whether or not the axes rotating will mess up the result or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just warped round kerbin running this script:
Until false {
set dir1 to vecdrawargs(v(0,0,0),r(30,15,5):inverse:vector,red,"Dir1",5,true).
set dir2 to vecdrawargs(v(0,0,0),r(-30,-15,-5):vector,green,"Dir2",5,true).
}.
Both arrows stayed over lapping the whole way round.
Edit:
ok looking at this http://uk.mathworks.com/help/aerotbx/ug/quatinv.html
inverse of a quaternion is a bit more complex. so I guess the example isn't exactly correct (even if it appears to be) but the bit about opposite rotation is from here http://docs.unity3d.com/ScriptReference/Quaternion.Inverse.html. Do you want me to remove the example part and re-submit the PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think lacking an example is better than having an example but it being a misleading one. I'd say remove it.
(and so the issue can be closed)
Added :inverse detailed section
I think I have done this right. Let me know if I have set this up wrong.
Documentation for issue #652