Closed niutech closed 2 years ago
This would be a great addition if you want to implement such a method (add tests for it) and make a pull request.
Thanks for the feature request!
Could you tell me how to calculate it? There is a formula for a polygon, but what about Bezier curves? And how to get coordinates of all points of a path?
I'm unaware of any exact formula for bezier curves, but you can estimate the centroid (I imagine quite accurately) using the scipy quad
function and stoke's theorem. Here's an explanation
https://math.stackexchange.com/questions/3274160/finding-centroid-of-a-curve
I would like to scale a closed path (shape) using its centroid as an origin. How can I get the centroid? Could you please add this method to the Path class?