TP4 : Subdivision curves

4 March 2016 in

Code

Do

git pull

or, if you don’t have the local repo,

git clone https://github.com/bbrrck/geo-num-2016.git

As usual, test by

cd TP4/
mkdir build
cd build
cmake ..
make
./geonum_TP4 simple

Subdivision Curves

A subdivision curve is defined as the limit of recursive refinement of the input polyline $\mathbf x_i = \mathbf x_i^0$. Your today’s task is to implement three curve subdivision schemes from the lecture. For the sake of simplicity, we will be working with closed curves only.

Chaikin

Corner-cutting

$ 0 < a < b < 1 $ :

Four-point scheme

chaikin 4-point

First few iterations of the Chaikin’s algorithm (left) and the four-point scheme (right).

ToDo

  1. Implement the three subdivision schemes (for closed curves only). Test your implementation on the simple and infinity datasets. To visualise:
    python ../plots/plot.py simple|infinity
  2. Experiment with different values of $a,b$ in corner cutting. Specifically, try using
    • $b=a+\frac12$
    • $b \neq a+\frac12$

    What do you observe?

  3. (bonus) A generalized four-point scheme uses the mask $[-\omega,\frac12+\omega,\frac12+\omega,-\omega].$ The above version of the algorithm uses $\omega=\frac1{16}.$ Modify your implementation of this algorithm to account for the tension parameter $\omega$ and try varying its value. You should get $\mathcal C^1$ limit curves for $\omega \in \left[0,(\sqrt 5 - 1)/8 \approx 0.154 \right]$.

Resources