A Scripting Challenge

Lately I've been diving deeper into Quaternions, a complex mathematical operation we need in here for rotations.

So I wanted to get down to the nitty gritty of some of the math around it and thought a good way to do this was trying to recreate some of LL's methods we use. I thought a good place to start would be with creating a Quaternion from scratch. In particular implementing the Quaternion.FromEulerAngles(Vector a)

This is the pertinent info on how they do it.

A vector of angles in radians.

Rotates first around X (local/global coincide), then around new local Y, and finally around new local Z.

So I challenge programmers to write this method.

Testing it should involve creating several Quaternions from the Sansar method and then comparing your created one to theirs.

This is a good source of related info https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19770024290.pdf

I have been unable to replicate it so far myself.

Some Test Data

 (42,10,22.4) => 0.9060,0.3660,0.0100,0.2110
(39,59.2,69.4) => 0.5800,0.5030,0.2170,0.6020
(9.1,84.9,31.9) => 0.6920,0.2410,0.6310,0.2530
(22.3,2.6,57.8) => 0.8560,0.1800,-0.0740,0.4780
(61.4,89.1,28.8) => 0.5050,0.5020,0.4940,0.4990


Please sign in to leave a comment.