How to calculate the vertex of a parabola given three points

后端 未结 8 1142
故里飘歌
故里飘歌 2020-11-30 03:11

I have three X/Y points that form a parabola. I simply need to calculate what the vertex of the parabola is that goes through these three points. Preferably a quick way as I

8条回答
  •  时光说笑
    2020-11-30 04:12

    I've done something similar to @piSHOCK's answer, also based on @AZDean's code. If you need to run it heavily (or to use it in Matlab like me), this might be the fastest one.

    My assumption is that x1 == -1, x2 == 0, x3 == 1.

    a = y2 - ( y1 + y3) / 2   % opposite signal compared to the original definition of A
    b = (y3 - y1) / 4         % half of the originally defined B
    
    xExtr = b / a
    yExtr = y2 + b * yExtr    % which is equal to y2 + b*b / a
    

提交回复
热议问题