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

[resource] quaternion calculator and euler angle translator #42

Open
dmarx opened this issue May 20, 2022 · 6 comments
Open

[resource] quaternion calculator and euler angle translator #42

dmarx opened this issue May 20, 2022 · 6 comments

Comments

@dmarx
Copy link
Member

dmarx commented May 20, 2022

https://quaternions.online/

@dmarx
Copy link
Member Author

dmarx commented May 21, 2022

https://discord.com/channels/869630568818696202/869675528494391307/911779334312837161

Я — 11/20/2021
To rotate about an axis [x, y, z] by a degrees you will need

rotate_3d: [cos(radians(a/2)),x*sin(radians(a/2)),y*sin(radians(a/2)),z*sin(radians(a/2))].

For example to rotate by 3 degrees per frame about:

  • The x axis (looking up and down): rotate_3d: [cos(radians(3/2)),sin(radians(3/2)),0,0]
  • The y axis (looking left and right): rotate_3d: [cos(radians(3/2)),0,sin(radians(3/2)),0]
  • The z axis (tilting your head side to side): rotate_3d: [cos(radians(3/2)),0,0,sin(radians(3/2))]

since cos(0) = 1 and sin(0) = 0, to rotate by 0 degrees (i.e. to not rotate) just do

rotate_3d: [1,0,0,0]

@dmarx
Copy link
Member Author

dmarx commented Jun 4, 2022

you need to understand how much you want to rotate each frame and also what axis you want to rotate around
representing the axis as a unit vector x,y,z
the rotation is rotate_3d: [cos(a),x*sin(a),y*sin(a),z*sin(a)]
where a is the rotation angle in radians
so to very that with time you make a a function of t

-- https://discord.com/channels/869630568818696202/869675528494391307/924046784408453150

@dmarx
Copy link
Member Author

dmarx commented Jun 4, 2022

<blockquote class="twitter-tweet"><p lang="en" dir="ltr"><a href="https://t.co/7y7B0XyTKm">https://t.co/7y7B0XyTKm</a><br><br>rotate_3d: [cos(radians(6)),0,-sin(radians(6))/sqrt(2),sin(radians(6))/sqrt(2)]<br><br>translate_x: -1700*sin(radians(6)) <a href="https://t.co/BCQTYkRRjz">pic.twitter.com/BCQTYkRRjz</a></p>&mdash; ya (@sportsracer48) <a href="https://twitter.com/sportsracer48/status/1451562757174743047?ref_src=twsrc%5Etfw">October 22, 2021</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

@dmarx
Copy link
Member Author

dmarx commented Jun 12, 2022

Alternatively, the R_is_Ris vesrion

[cos(pi/a),cos(pi/(a*b)),d*cos(pi/(a*c)),cos(pi/a)], where abcd are constants that suit the motion of the scene (higher value, slower rotation)

@dmarx
Copy link
Member Author

dmarx commented Jun 12, 2022

this isn't a docs thing, but this feels like the right place to put it for now: https://github.com/moble/quaternion

@dmarx
Copy link
Member Author

dmarx commented Jun 18, 2022

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

No branches or pull requests

1 participant