1
Graphics / Re: Drawing a circle segment
« on: November 22, 2017, 08:37:15 pm »
Now I see the point of your solution, it's better than mine.
Thanks for the help!
Thanks for the help!
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
const float a = (angle - spread / 2.f) + (i * spread) / (maxpts - 1);
gameWindow.clear(sf::Color{ 60, 60, 60 });
float angle = PI;
float radius = 50;
unsigned points = 50;
VertexArray circle(LinesStrip, 0);
Vector2f orgin = gameWindow.getView().getCenter();
do
{
Vector2f pointPos = { cos(angle) * radius, sin(angle) * radius };
pointPos += orgin;
circle.append(pointPos);
angle -= PI * 2 / points;
} while (angle > -PI);
circle.append(circle[0]);
gameWindow.draw(circle);
gameWindow.display();
alpha = atan2(mouse.y, mouse.x);
beta = alpha - alpha / 2;
gamma = alpha + alpha / 2;