Skip to main content
GameDev.net gamedev.net
🔒 Locked 🎮 Unity

Quaternion Test Data

Started by roguan Jan 19, 2011 at 9:15 AM 1 replies 2.9k views
Original Post
roguan
roguan
Hey,
Perhaps you know where to find some test data for Quaternion rotations.

I'm writing some JUnit test cases for my Quaternion class and would like to find some input/output data from series of arbitrary Quaternion operations.

Thanks in advance.
sgt_barnes
sgt_barnes
Here is what I use to test my quaternions:

* First, rotate an arbitrary vector around an arbitrary axis using an arbitrary angle (of course with a quaternion).

* Then compare the original to the result vector, considering length and angle. If the length is constant and the angle is as desired, everything is fine and you are "green".

* Now generate a series of rotation quaternions and concatenate them. Transform an arbitrary vector with it.

* Now use each individual transformation of that series to transform the vector again, but this time checking angle and length like in the single transformation case. Only proceed while you stay "green".

* Finally, compare both results. If they match, you are "green".

That way, an error might still go unnoticed, but if you generate enough different test cases, the probability for that should be very small.
roguan
roguan
Hey!
I do appreciate the advice! I'll definitely do something along those lines.

Thanks!


Here is what I use to test my quaternions:

* First, rotate an arbitrary vector around an arbitrary axis using an arbitrary angle (of course with a quaternion).

* Then compare the original to the result vector, considering length and angle. If the length is constant and the angle is as desired, everything is fine and you are "green".

* Now generate a series of rotation quaternions and concatenate them. Transform an arbitrary vector with it.

* Now use each individual transformation of that series to transform the vector again, but this time checking angle and length like in the single transformation case. Only proceed while you stay "green".

* Finally, compare both results. If they match, you are "green".

That way, an error might still go unnoticed, but if you generate enough different test cases, the probability for that should be very small.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.