Approximate and animate extracted contours from a given png using DFT. Inspired by 3b1b.

Introduction

Epicycles

In general, epicycles are curves defined by the equations:

therefore

e.g.

The parametric path for the curve can be denoted as:

DFT

The Discrete Fourier Transform (DFT) is defined as

where
Its inverse transform (IDFT) is given by:

where

Trigonometric interpolation

Consider a set of points belonging to the parametric curve

The goal of trigonometric interpolation is to find a trigonometric polynomial that passes through these points.
A trigonometric polynomial of degree (where typically for an odd number of points, or for an even number of points) is given by:

To find the coefficients , note that the coefficients can be obtained directly from the DFT coefficients by the relation .

Interpolation Process

Compute DFT: Apply DFT to the given data points to obtain the coefficients .

Construct Trigonometric Polynomial: Use the coefficients to construct the trigonometric polynomial .

Interpolation: To interpolate or estimate the value at any point , plug the value of into the polynomial . This gives you the interpolated value at that point.

Visualization with Manim

Manim was created by Grant Sanderson, better known as the person behind the YouTube channel "3Blue1Brown". It was developed to produce the distinctive and visually appealing animations seen in his videos, which explain a wide range of mathematical concepts.

ManimCE is a fork of the original Manim project. It's community-driven and open-source, with contributions from a broader community of developers.