“Coding Druid” series is my horizontal programming practice notes, each part around a topic like mathematical, physics, electronic, graphics, sound, etc., implemented in several programming languages.
Coding Druid
Part: Math
Chapter: Fourier Series
Section: Unity
In the previous Chapter, I visualized Trigonometric function (Sine and Unit Circle) separately using MaxMSP, JavaScript (React), Python, and Unity:
This chapter I implement Fourier Series curve visualization.
And Unity this section.
When it comes to Fourier transform or Fourier analysis, it is usually divided into two parts: Fourier series and Continuous Fourier transform. This chapter focuses on the Fourier series.
In mathematics, a Fourier series is a periodic function composed of harmonically related sinusoids, combined by a weighted summation.
(wikipedia)
For example, suppose there is a square wave, and it can be interpreted into sine waves.
The more sine waves you have, the preciser square wave you will get:
More graphic explanations and formula derivation, see the previous section: Fourier Series Visualization Using React Hooks .
The effect of the previous section:
Now let’s try Unity.
Have written an note Sine function visualization using Unity3D. So on the basis of its code, the drawing formula can be modified from the trigonometric function to the lower Fourier series:
The full code can be seen later.
Final effect:
References:
- Wikipedia
- Sine function visualization using Unity3D
- Fourier Series Visualization Using React Hooks
- Building a Graph Visualizing Math
Talk is cheap. Show me the code!
This demo and the Coding Druid series is open source here:
https://github.com/avantcontra/coding-druid
You may buy me a coffee in my Patreon. There are many articles, patches, source code and some advanced Patron-only content there.
Also you can get some free patches/codes in Gumroad shop.
Your encouragement is my driving energy!
Cheers~
Contra
- Website: floatbug.com
- Github: avantcontra
- Facebook: avantcontra
- Twitter: avantcontra
- Instagram: avantcontra
- Gumroad (buy codes directly): avantcontra
- Patreon (advanced content): avantcontra
Comments
One response to “Fourier Series Visualization Using Unity”
[…] Above is Python (Blender) version. There are JavaScript (React) version, and Unity version. […]