1
Graphics / possible bug with sf::circleShape points not updating
« on: October 12, 2023, 10:09:52 pm »
I think I have discovered a bug with the circleShape.
I was trying to positions elements in a circle formation by creating a circle and using its points positions to determine the positions of the elements I wanted to create. But it seems that using the setPosition() on circleShape doesn't move the circle points locations with it.
Here is a simple code proving it
#include <SFML/Graphics.hpp>
void printPointsLocations(sf::CircleShape& circle) {
for (int i = 0; i < circle.getPointCount(); i++) {
printf("Point %d: (%f, %f)\n", i, circle.getPoint(i).x,
circle.getPoint(i).y);
}
}
int main() {
sf::CircleShape circle(100.f, 5);
printf("Default circle:\n");
printPointsLocations(circle);
printf("Default circle position: (%f, %f)\n", circle.getPosition().x,
circle.getPosition().y);
circle.setPosition(sf::Vector2f(100.f, 0));
printf("Moved circle circle:\n");
printPointsLocations(circle);
printf("Moved circle position: (%f, %f)\n", circle.getPosition().x,
circle.getPosition().y);
}
and in attached files my result in my terminal. As you can see the circle has been moved, but the points are at the same place, while I am expecting them to be 100px further after setting the new positions of the circle.
I am aware my issue can be fixed by applying my transformation the the points I am given instead, but it is still a bug for me
I am using SFML 2.6 and VS 2019 compiler on Windows 11.
I was trying to positions elements in a circle formation by creating a circle and using its points positions to determine the positions of the elements I wanted to create. But it seems that using the setPosition() on circleShape doesn't move the circle points locations with it.
Here is a simple code proving it
#include <SFML/Graphics.hpp>
void printPointsLocations(sf::CircleShape& circle) {
for (int i = 0; i < circle.getPointCount(); i++) {
printf("Point %d: (%f, %f)\n", i, circle.getPoint(i).x,
circle.getPoint(i).y);
}
}
int main() {
sf::CircleShape circle(100.f, 5);
printf("Default circle:\n");
printPointsLocations(circle);
printf("Default circle position: (%f, %f)\n", circle.getPosition().x,
circle.getPosition().y);
circle.setPosition(sf::Vector2f(100.f, 0));
printf("Moved circle circle:\n");
printPointsLocations(circle);
printf("Moved circle position: (%f, %f)\n", circle.getPosition().x,
circle.getPosition().y);
}
and in attached files my result in my terminal. As you can see the circle has been moved, but the points are at the same place, while I am expecting them to be 100px further after setting the new positions of the circle.
I am aware my issue can be fixed by applying my transformation the the points I am given instead, but it is still a bug for me
I am using SFML 2.6 and VS 2019 compiler on Windows 11.