Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

3.4 Bezier Curves and de Casteljau

Lesson 22 of 32 in the free Computer Graphics notes on Siksha Sarovar, written by Rohit Jangra.

Defining Data

A degree-n Bezier curve is defined by n+1 control points P0, P1, ..., Pn: P(u) = sum over i=0..n of B_(i,n)(u) P_i, u in [0, 1], where B_(i,n)(u) = C(n, i) u^i * (1-u)^(n-i) is the Bernstein polynomial.

Cubic Bezier (n=3)

P(u) = (1-u)^3 P0 + 3(1-u)^2 u P1 + 3(1-u) u^2 P2 + u^3 P3.

Properties

  1. Endpoint interpolation: P(0) = P0, P(1) = P3.
  2. Tangent at endpoints: P'(0) = 3(P1 - P0), P'(1) = 3(P3 - P2). The curve leaves P0 toward P1 and arrives at P3 from P2.
  3. Convex hull: the entire curve lies inside the convex hull of its control points.
  4. Affine invariance: applying an affine transform to the control points is the same as applying it to the curve.
  5. Variation-diminishing: a straight line crosses the curve no more times than it crosses the control polygon.
  6. Partition of unity: sum of B_(i,n)(u) = 1 for all u, so any control-point combination is an affine combination.

de Casteljau Algorithm

A numerically stable, geometrically intuitive way to evaluate P(u) for a given u:

  1. P_i^0 = P_i for i=0..n.
  2. For r=1..n: P_i^r(u) = (1-u) P_i^(r-1)(u) + u P_(i+1)^(r-1)(u), for i=0..n-r.
  3. P_0^n(u) = P(u).

It also splits the curve at u into two Bezier sub-curves whose control points are by-products of the algorithm.

Worked Example

Cubic with P0 = (0,0), P1 = (1,2), P2 = (3,2), P3 = (4,0). Evaluate at u=0.5:

  • Layer 1: Q0 = 0.5(0,0)+0.5(1,2) = (0.5,1); Q1 = 0.5(1,2)+0.5(3,2) = (2,2); Q2 = 0.5(3,2)+0.5(4,0)=(3.5,1).
  • Layer 2: R0 = 0.5Q0+0.5Q1 = (1.25, 1.5); R1 = 0.5Q1+0.5Q2 = (2.75, 1.5).
  • Layer 3: P(0.5) = 0.5R0 + 0.5R1 = (2, 1.5).

Why Bezier Wins in Design

  • Drag a control point - curve responds locally to leg P_(i-1)-P_i-P_(i+1) and globally is bounded by the hull, so artists predict shape change well.
  • Used in fonts (TrueType uses quadratic Bezier; PostScript and CFF use cubic), Illustrator paths, Inkscape, SVG.

Joining Bezier Segments

For C1 across two cubic Bezier segments meeting at a shared endpoint S, the leg lengths and direction must match: the previous segment's last leg and the next segment's first leg are colinear and equal-length. Many illustration tools call this a smooth handle.