Proof that a point in a triangle is inside a quadratic Bezier curve.

bezier-curvegeometryparametricpolynomialsvector-spaces

Given 3 control points, there is a theorem that states that for a point to be inside the region enclosed by the curve and the triangle, the baryxentric coordinates of the point must obey:

$(\frac{s}{2} + t)^2 < t$

Where the barycentric coordinates are $sP_0 + tP_1 + (1-s-t)P_2$ and the points in the bezier curve are the same points.

I have been trying to come up with the proof of this statement and have failed. The most I have been able to prove is that the point is on the curve if:

$(\frac{s}{2} + t)^2 = t$.

The place I originally got the formula from has some useful diagrams that make it easier to understand what is going on:

https://medium.com/@evanwallace/easy-scalable-text-rendering-on-the-gpu-c3f4d782c5ac

If someone could provide a step by step proof, focusing more in the intuition than the formality, that'd be awesome!

Edit: I think I may have made a mistake in my proof that: $(\frac{s}{2} + t)^2 = t$. I made an invlaid assumption.

I know this is a new part of the question I didn;t originally post, but, could someone also provide a proof of that statement?

Best Answer

Let $F(s,t)=(s/2+t)^2-t$. The equation $F(s,t)=0$ describes the locus of the points of the plane lying on the given quadratic Bézier curve (which is nothing but a parabola).

If $A$ and $B$ are two points of the plane such that $F(A)>0$ and $F(B)<0$ (I hope the notation is clear), then any continuous curve joining $A$ with $B$ must intersect the parabola by Bolzano's theorem, because $F$ is a continuous function. Hence $A$ and $B$ lie on opposite sides of the parabola: equation $F(s,t)<0$ describes the locus of points which are on the same side of the parabola as $B$, while $F(s,t)>0$ describes the locus of points which are on the same side of the parabola as $A$.

Observe now that the midpoint $M$ of $P_1P_2$ lies on the region enclosed by the curve and the triangle, and its barycentric coordinates are $s=0$, $t=1/2$, so that $F(M)=-1/4<0$. By the above reasoning, all the other points in that region are on the same side of the parabola as $M$ and have then $F(s,t)<0$.

EDIT.

For a quadratic Bézier curve joining $P_1$ with $P_2$ and having $P_0$ as control point, we want to prove that $(s/2+t)^2=t$, where $s$ and $t$ are the barycentric coordinates (relative to $P_0$ and $P_1$)) of any point $P$ on the curve.

I'll consider the simple case where $P_1=(-1,1)$, $P_2=(1,1)$ and $P_0=(-1,0)$, so that the Bézier curve is the parabola of equation $y=x^2$ (see figure below). The general case can be obtained from that by an affine transformation, which preserves both the barycentric coordinates of point $P$ and its lying on the Bézier curve.

Let then $P=(x,x^2)$ be any point on the parabola. It's easy to find that $$ PA=1-x^2,\quad MC=MB={1\over2}MP_0={1+x^2\over2},\quad PB={1+x^2\over2}-x={(1-x)^2\over2}. $$ Barycentric coordinates $s$ and $t$ are respectively the areas of triangles $PP_1P_2$ and $PP_0P_2$, divided by the area of $P_0P_1P_2$ (which is $2$). Hence: $$ s={1\over2}PA={1-x^2\over2},\quad t={1\over2}PB={(1-x)^2\over4}. $$ It is now easy to check that: $$ \left({s\over2}+t\right)^2=\left({1-x^2\over4}+{1-2x+x^2\over4}\right)^2 =\left({1-x\over2}\right)^2=t. $$

enter image description here