Graphite
Graphite copied to clipboard
Bezier-rs: function to compute subpath centroid
This function should find the centroid (center of mass) of a subpath's area. (If the subpath isn't closed, treat it as closed.) If it's computationally feasible, this should be done analytically, otherwise a quality factor should be supplyable if going with an approximated approach. The person who works on this feature should research both routes and, if going with the approximation one, explain the reasoning that resulted from researching the problem and why an analytic solution isn't viable or performant compared to a reasonable quality factor given for an approximated solution.
This issue doesn't require learning any of the Graphite code base, it is just a part of Bezier-rs which is a separate code base for computational geometry located in /libraries/bezier-rs
.
Hey @Keavon , I feel I can work on this issue. I would like to share my thought process with you, if you feel it correct then I will proceed further.
- First we can define the control points for the curve.
- Create the Bezier curves using control points (2 points quadratic or 3 points cubic).
- Evaluate the n number of points.
- Then we can calculate the area and centroid by using methods like Shoelace formula or Green's theorem
Done