Commit a1fd3e8d authored by Zheheng Liu's avatar Zheheng Liu
Browse files

Latest fix to quaternion function


Signed-off-by: Zheheng Liu's avatarZheheng Liu <zheheng.liu@esrf.fr>
parent aa56a264
......@@ -20,5 +20,5 @@ end
% |r| = tan(theta/2), so sqrt(1+|r|^2) = 1/cos(theta/2)
cosine_half_theta_reciprocal = sqrt(1 + sum(abs(r) .^ 2, 1));
% q = [cos(theta/2); cos(theta/2)*r] = [1; r] * cos(theta/2)
q = bsxfun(@(x, y) x ./ y, [ones(size(cosine_half_theta_reciprocal)); r], cosine_half_theta_reciprocal);
q = bsxfun(@rdivide, [ones(size(cosine_half_theta_reciprocal)); r], cosine_half_theta_reciprocal);
end % end of function
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment