a guest Jun 16th, 2019 100 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- For rotation along the X-axis (Y-movement), Vector A + Vector B has only a Y component - x cancels out.
- For rotation along the Y-axis (X-movement), Vector A + Vector B has only an X component - y cancels out.
- For rotation along the Z-axis (clock-movement), Vector A = Vector B.
- To find, therefore, the axis of rotation and speed, we're going to need to do some math.
- X-axis rotation = Y component of Vector A + Vector B. Perhaps the average?
- Y-axis rotation = X component of Vector A + Vector B. Perhaps the average?
- Z-Axis rotation = sqrt((common X from A to B)^2 + (common Y from A to B)^2)
- Take the x-axis rotation (which is y movement) and treat it as the x-component of a circle.
- Take the y-axis rotation (which is x movmeent) and treat it as the y-component of a circle.
- Arctan (y/x) = angle of the axis of rotation in the x-y plane = azimuth.
- If x is negative, add 180 to account for the range of the arctan function.
- Find the amount of that rotation - which will be sqrt(x^2+y^2) for magnitude, and we're going to find the amount of Z axis rotation, too -
- arctan (z/(x-y magnitude)) = polar angle, measured from 90 to -90 rather than the standard 0 to 180, but you get the gist.
RAW Paste Data