How I can calculate the normal vector for two dimensional Bézier curve?

(I have the control points of the curve in the x y plane)


If vector (x,y) is a tangent vector of your curve, then the normal vector is simply (y,-x). So you just need to find a tangent vector, and it all depends on how exactly you define the curve.

If your curve comes from a parametric representation p(t) = (x(t),y(t)) which is sufficiently continuous, then a good approximation of the tangent vector at t is, given a very small ɛ:

v(t) = ———————————

         x(t+ɛ)-x(t)   y(t+ɛ)-y(t)
v(t) = ( ——————————— , ——————————— )
              ɛ             ɛ

This applies to e.g. Bézier curves.

If your curve comes from a dense list of points then a good approximation comes from taking the two closest points on the curve, p0 and p1, and then your tangent is:

v(t) = (p1 - p0) / distance(p1, p0)

If your curve comes from a scattered list of points then the above method will probably exhibit too many discontinuities, but so will your curve unless you use some kind of interpolation. What I suggest is consider the interpolation function (for instance, cubic interpoltion) as a parametric function, and apply the first method.

| improve this answer | |
  • \$\begingroup\$ thank you for answer me. please can you clarify the above equations(related with Bezier curves) with a simple example using actual numbers? I don't understand what t,ɛ meant and how calculated . @Sam Hocevar \$\endgroup\$ – rasha May 24 '15 at 16:38
  • \$\begingroup\$ can you show us how you are getting the points on the curve? Is it a cubic bezier? Quadratic? It it 2d or 1d (explicit)? \$\endgroup\$ – Alan Wolfe May 24 '15 at 19:15

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.