Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Matthew Mott committed Mar 21, 2021
1 parent 4ce21a8 commit 4dd7813
Showing 1 changed file with 3 additions and 38 deletions.
41 changes: 3 additions & 38 deletions radiantcore/selection/algorithm/Transformation.cpp
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 4dd7813

Please sign in to comment.