Skip to content
Snippets Groups Projects
Commit 7723f10e authored by Oliver Sander's avatar Oliver Sander Committed by sander@PCPOOL.MI.FU-BERLIN.DE
Browse files

stable exponential mapping due to grassia

[[Imported from SVN: r853]]
parent 8c104f3b
No related branches found
No related tags found
No related merge requests found
......@@ -28,11 +28,12 @@ public:
Quaternion<T> q;
T normV = std::sqrt(v0*v0 + v1*v1 + v2*v2);
T sin = std::sin(normV/2)/normV;
// Stabilization for small |v| due Grassia
T sin = (normV < 1e-4) ? 0.5 * (normV*normV/48) : std::sin(normV/2)/normV;
// if normV == 0 then q = (0,0,0,1)
if (isnan(sin))
sin = 0;
assert(!isnan(sin));
q[0] = sin * v0;
q[1] = sin * v1;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment