From 4dd78138fd655bc0605918c77264dbf194e3d13f Mon Sep 17 00:00:00 2001 From: Matthew Mott Date: Sun, 21 Mar 2021 20:46:44 +0000 Subject: [PATCH] Remove rotateSelectionAboutAxis() This function was only ever called with 90 degree rotations, meaning that most of the code was unnecessary. The initial block which specifically handled 90 degree rotations has now been moved directly into the calling functions. --- .../selection/algorithm/Transformation.cpp | 41 ++----------------- 1 file changed, 3 insertions(+), 38 deletions(-) diff --git a/radiantcore/selection/algorithm/Transformation.cpp b/radiantcore/selection/algorithm/Transformation.cpp index 44d57d2c58..dfee7c9172 100644 --- a/radiantcore/selection/algorithm/Transformation.cpp +++ b/radiantcore/selection/algorithm/Transformation.cpp @@ -529,41 +529,6 @@ inline Quaternion quaternion_for_axis90(axis_t axis, sign_t sign) } } -void rotateSelectionAboutAxis(axis_t axis, float deg) -{ - if (fabs(deg) == 90.0f) - { - rotateSelected(quaternion_for_axis90(axis, (deg > 0) ? eSignPositive : eSignNegative)); - } - else - { - switch(axis) - { - case 0: - rotateSelected( - Quaternion::createForMatrix( - Matrix4::getRotationAboutX(math::Degrees(deg)) - ) - ); - break; - case 1: - rotateSelected( - Quaternion::createForMatrix( - Matrix4::getRotationAboutY(math::Degrees(deg)) - ) - ); - break; - case 2: - rotateSelected( - Quaternion::createForMatrix( - Matrix4::getRotationAboutZ(math::Degrees(deg)) - ) - ); - break; - } - } -} - void rotateSelectionX(const cmd::ArgumentList& args) { if (GlobalSelectionSystem().countSelected() == 0) @@ -573,7 +538,7 @@ void rotateSelectionX(const cmd::ArgumentList& args) } UndoableCommand undo("rotateSelected -axis x -angle -90"); - rotateSelectionAboutAxis(eAxisX, -90); + rotateSelected(quaternion_for_axis90(eAxisX, eSignNegative)); } void rotateSelectionY(const cmd::ArgumentList& args) @@ -585,7 +550,7 @@ void rotateSelectionY(const cmd::ArgumentList& args) } UndoableCommand undo("rotateSelected -axis y -angle 90"); - rotateSelectionAboutAxis(eAxisY, 90); + rotateSelected(quaternion_for_axis90(eAxisY, eSignPositive)); } void rotateSelectionZ(const cmd::ArgumentList& args) @@ -597,7 +562,7 @@ void rotateSelectionZ(const cmd::ArgumentList& args) } UndoableCommand undo("rotateSelected -axis z -angle -90"); - rotateSelectionAboutAxis(eAxisZ, -90); + rotateSelected(quaternion_for_axis90(eAxisZ, eSignNegative)); } void mirrorSelection(int axis)