From 022269a13b10a33131dace614132db825426527a Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sun, 28 Apr 2019 17:48:41 +0800 Subject: [PATCH] refactor --- src/m_rotation.scad | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/m_rotation.scad b/src/m_rotation.scad index 2c01ae2f..48882d45 100644 --- a/src/m_rotation.scad +++ b/src/m_rotation.scad @@ -2,12 +2,13 @@ include <__private__/__m_multiply.scad>; function _q_rotation(a, v) = let( + half_a = a / 2, axis = v / norm(v), - s = sin(a / 2), + s = sin(half_a), x = s * axis[0], y = s * axis[1], z = s * axis[2], - w = cos(a / 2), + w = cos(half_a), x2 = x + x, y2 = y + y,