Algorithm to find the center of a Bezier curve

I need to find the center of a Bezier curve to rotate it. I have a list of all points (control points, beginning and end, all points on the curve itself). How would I go about finding it's center?

• Curves are mathematical entities they do not have centers as such. However you might be looking for bouding box center, minimum bounding box center, center of gravity of the enclosed area underlying the curve when endpoints are connected, center of gravity of closed polybeziers, curve midpoint, control point average etc. Jun 27, 2016 at 21:41
• @joojaa there are definitely 2 natural centers I can think of, one is the t=0.5 point. and two is the geometric midpoint regarding travel cartesian distance along the line. Jun 28, 2016 at 6:12
• @v.oddou yes in fact there are many more thats why the question needs clarification. All vector applications that i have used (Illustrator, xara, corel, sketch, etc..) Use the local bounding box center to rotate objects, so its rare to see the other center definitions used at all. Jun 28, 2016 at 6:44

2 Answers

Bézier curves are mathematical entities and have no clearly defined center. One can in fact define many different things as the center of the Bézier curve. I have tried to depict some of the possible centers in image 1. More than this do exist.

Image 1: Some of the possible centers of a single span Bézier curve

In practice nearly all graphics applications geared for drawing use the center of the local bounding box (BB) as their center. Animation software usually have an additional concept of pivot so they use the ask user approach, if no input is made they often revert to BB center or simply local coordinate center. This is probably because the BB needs to be calculated anyway and getting its center is pretty easy to do (see A Primer on Bézier Curves).

The center of gravity metrics are also somewhat natural especially in an animation context, though nastier to compute. Easiest being to discretize the data and do the computation on the discrete input. This said some closed form solutions are possible for the curve center of gravity, but it's not a very nice equation to formulate and simplify.

Then we have the on the curve points: the midpoint by arc length and the point where the $t$ parameter is 0.5. In my mind the $t$ param is often problematic though easy to compute, and it loses meaning when you chain multiple Béziers after each other for a polybézier. The center of length of course is only natural as long as the curve is not closed.

We also define other possible centers, the center could be at the curve center of gravity of the hull, the average of the control points or the control cage BB center. Although in practice these do not seem to work out very well.

Please note: Although the curve in picture 1 shows the BB center quite near to some natural centers this this is not always the case for more complex curves and especially polybéziers.

• I wouldn't call this a comment. I'd call it an excellent answer that addresses the asker's current level of knowledge, explains fully why the question is broader than expected, and opens the way for new questions. Jun 28, 2016 at 14:00
• @trichoplax though could be summarized as "define center" by the less polite. Jun 28, 2016 at 15:24
• @ratchetfreak I prefer answers that try to identify the knowledge gap of the asker rather than expecting them to fully understand the topic they are asking about. Jun 28, 2016 at 17:56
• I'm looking for a way to get the DISTANCE MIDPOINT for my quad and cubic bezier curves. I was using t value 0.5 and as you said I just realized it's problematic. What I'm trying to do now with the bezier calculation is moving balls at even speed. But using t value makes it so hard.. I think I need to find proper t values depending on the arc length. Any resource or a small hint for me, please? Dec 14, 2016 at 20:59
• Unfortunately no sinple general closed form solution exists for beziers but a good resource that covers numerically doing this and more can be found Here tough i read today at work a even better resource should link to it but i havent got the link on my phone. But perhaps this is enough @Jenix Dec 14, 2016 at 21:06

Since we're not told what defintion of "center" to use, we may as well use the easiest. This would be $$\text{Center} = \frac14( \mathbf{P}_0 + \mathbf{P}_1 + \mathbf{P}_2 + \mathbf{P}_3)$$ where $\mathbf{P}_0$, $\mathbf{P}_1$, $\mathbf{P}_2$, $\mathbf{P}_3$ are the control points of the curve.