Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

TP1 : Bézier curves, De Casteljau’s algorithm

In this TP, you'll implement the De Casteljau’s algorithm, and you'll use it to compute and visualise the curves in the data folder. Start by cloning the repo and testing the code for the TP1.

cd your/working/dir/
git clone
cd GeoNum2017/TP1

You should see something like the following figure.

simple Bezier control polygon

To test with different datasets and sampling densities, you can pass the arguments directly in the command line.

python [simple,infinity,spiral]  [sampling_density]

# for instance
python spiral 24

Code structure

The code in contains three helper functions plus the main part.

  • ReadPolygon : reads Bézier curve control polygon from a file. The result is returned as a 2-column matrix.
  • DeCasteljau : returns the point b_i^k from De Casteljau algorithm.
  • BezierCurve : uniform evaluation of the Bézier curve.
  • main part : controls the computation and plots results.


  1. Implement the De Casteljau algorithm (DeCasteljau) and use it to evaluate the provided Bézier curves (BezierCurve). Visualise the curves together with their control polygons.
  2. Try varying the sampling density. How many samples are needed to give the impression of a smooth curve?
  3. Pick one dataset and visualise all intermediate polygons b_i^k from the De Casteljau algorithm for a fixed parameter, for instance t=0.5. Hint: each column in the schema represents one such polygon.

De Casteljau intermediate polygons

You can’t perform that action at this time.