1
SFML development / Re: virtual Vector2f sf::Shape::getCentroid() const = 0;
« on: April 24, 2023, 07:41:34 am »I think it could make sense to add something like this.
Great! I just made my first PR https://github.com/SFML/SFML/pull/2536 and hope I didn't miss anything.
- Due to the complexity, we'd probably need to cache the calculation
Yes, either that or document the complexity and suggest only calling it once after a Shape has been defined. A user wanting to call it many times could then cache the result.
- The result should probably be in local coordinate space
Yes. It would use the data in std::vector<Vector2f> ConvexShape::m_points; as-is and return the untransformed value.
- I personally would prefer getGeometricCenter() over Centroid
I'm perfectly fine with that too