# comp.graphics.algorithms

## Subject: Re: is a point 'inside' a bezier?

On 30 Apr 2006 00:41:11 -0700, daniel.w.gelder@gmail.com wrote:
>I was wondering if anyone knew of a technique for testing which side of
>a quadratic bezier a point is on, which is as simple as checking a
>sign. Hopefully it won't involve a square root operation, too.

Careful. A quadratic Bezier curve is a conic, so some sense can be
made of the idea of "which side" in 2D, but in general this is poorly
defined. It is not hard to convert a parametric curve (Bezier form) to
an implicit curve. The curve will be the zero set of a quadratic
polynomial for a quadratic Bezier curve, so a test could be as simple
as evaluating then looking at the sign of the result.

Following Sederberg, we implicitize a degree-2 (non-rational) Bezier
curve as follows:

[L01(x,y) L02(x,y)]
f(x,y) = det [L02(x,y) L12(x,y)]

where, for i,j in {0,1,2}

[x y 1]
Lij(x,y) = det [xi yi 1] (n?i) (n?j)
[xj yj 1]

with (n?k) the binomial coefficient n!/k!(n-k)! and n=2. If the curve
is rational with weights wk, multiply Lij by wi and wj.

For example, consider the curve with control points

P0 = (1,0) P1 = (1,1) P2 = (0,2)

Then f(x,y) = 4 - 4x - y^2.