0
$\begingroup$

I need to create a parabolic shape with a given starting point, maximum point, and end point. I thought the most efficient way to do this is to use a bezier curve. However there is no major relationship (that I could find) that relates a control point of a Bezier curve with its maximum point (which is why I am asking this question)

So given the starting point and ending point as well as the maximum point of a parabola, is it possible to write an algorithm which could calculate the control points of a Bezier curve that would be the same shape of a parabola? If so how?

Update: After some searching on the internet I found this question on SO which answers the opposite of what I am trying to achieve. It finds the max/min of a bezier curve while I am trying to find the control point of a parabola. I could subject the given formula for the control point, but this requires me to play around with t and I sense a lot of inefficiency, all the other resources seem to deal with curvature, which is not what I'm after. Is there any good way to deal with this problem?

Quick Fix: So I used this question from SO and the references in this answer from the mathematics stack to research on these curves. Then I played with the equations until I found something. If the third control point lies on the perpendicular bisector of the starting and ending points, the maximum/minimum point also lies on the bisector. Logically this makes sense as then the curve is symmetric. For my use case, the curve has the same y coordinate when it starts and ends, and the third point is between the two points (Visualisation here) so I exploited this and substituted $t = 0.5$ into $ M = A*(1-t)^2 + B*2t(1-t) + C*t^2$ where A is the starting point, C the ending point B the 3rd control point and M is the max/min point. A little bit of rearrangement gives that $B = 2M-0.5C-A$ which is perfect for my use case, as I only have to calculate the y coordinate because the x coordinate is effectively the x coordinate of B, but is still not general enough to act as a answer to my question. Perhaps someone could generalise it?

(I am beginning to feel as if this should have been posted in the math stack. Apologies for being so short sighted and not realising the mat.)

$\endgroup$
4
  • 1
    $\begingroup$ What did you try? Have you tried searching for a solution? What did you not find out? $\endgroup$
    – Pål GD
    Dec 17 '20 at 11:00
  • $\begingroup$ @PålGD I found this question on SO but it answers the opposite of what I am trying to achieve. It finds the min/max of a bezier while I need to turn a parabola with a given min/max into a bezier. I will update my question with more info $\endgroup$
    – Kingteena
    Dec 17 '20 at 13:47
  • $\begingroup$ If you need to generate a parabola, why not simply use a parabola, instead of trying to make a Bezier curve approximate a parabola? I suspect I must be missing part of the context or motivation. $\endgroup$
    – D.W.
    Dec 17 '20 at 19:50
  • $\begingroup$ @D.W. I am trying to create it in a iOS app and a framework called SpriteKit, which does not have a 'parabola' per se, but sectors or arcs, or what I am going for, a bezier curve known as UIBezierCurve $\endgroup$
    – Kingteena
    Dec 18 '20 at 4:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.