Skip to content
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

Merged
merged 3 commits into from
Apr 14, 2015
Merged

Added :inverse detailed section #794

merged 3 commits into from
Apr 14, 2015

Conversation

TDW89
Copy link
Contributor

@TDW89 TDW89 commented Apr 13, 2015

I think I have done this right. Let me know if I have set this up wrong.
Documentation for issue #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)`.

Copy link
Member

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.)

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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?

Copy link
Member

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)
Dunbaratu added a commit that referenced this pull request Apr 14, 2015
Added :inverse detailed section
@Dunbaratu Dunbaratu merged commit ecfd90f into KSP-KOS:develop Apr 14, 2015
@TDW89 TDW89 deleted the patch-1 branch April 15, 2015 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants