Skip to content

Commit

Permalink
#5128: Display the angle of rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Sep 16, 2021
1 parent 4712eb5 commit 15bfb65
Showing 1 changed file with 20 additions and 1 deletion.
Expand Up @@ -167,9 +167,28 @@ void TextureToolRotateManipulator::renderComponents(const Matrix4& pivot2World)
glVertex3d(0, 0, 0);

auto startingPointOnCircle = _rotator.getStartDirection() * _circleRadius;
glVertex3d(startingPointOnCircle.x(), startingPointOnCircle.y(), 0);

// 3 degree steps
auto stepSize = degrees_to_radians(3.0);

if (stepSize < std::abs(angle))
{
auto steps = floor(std::abs(angle) / stepSize);
stepSize = angle < 0 ? stepSize : -stepSize;

for (auto i = 0; i < steps; ++i)
{
auto curAngle = i * stepSize;
auto pointOnCircle = Matrix3::getRotation(curAngle).transformPoint(startingPointOnCircle);
pointOnCircle /= pointOnCircle.getLength();

glVertex3d(pointOnCircle.x(), pointOnCircle.y(), 0);
}
}

auto currentPointOnCircle = _rotator.getCurrentDirection() * _circleRadius;

glVertex3d(startingPointOnCircle.x(), startingPointOnCircle.y(), 0);
glVertex3d(currentPointOnCircle.x(), currentPointOnCircle.y(), 0);

glEnd();
Expand Down

0 comments on commit 15bfb65

Please sign in to comment.