Coding Druid
Img from www.deviantart.com

“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.

Mathematics

In the principle of not digging holes for yourself, I start from a (maybe) simple theory, the trigonometric function of junior high school mathematics.

挑个简单的...

Trigonometric function

In mathematics, the trigonometric functions (also called circular functions, angle functions or goniometric functions) are real functions which relate an angle of a right-angled triangle to ratios of two side lengths.
They are among the simplest periodic functions, and as such are also widely used for studying periodic phenomena, through Fourier analysis.
The most familiar trigonometric functions are the sine, the cosine, and the tangent.

— from wikipedia

Note that the blackened parts, sound and visual programming are mostly related to them.

Define a trigonometric function with a unit circle:
用单位圆定义三角函数
Img from Wikipedia

Cartesian coordinate system sin(x) and cos(x) function images:
直角坐标系sin(x)和cos(x)函数图像
Img from Wikipedia

Get together to understand:
单位圆三角函数
Img from Pinterest

MaxMSP implementation of trigonometric function visualization

Max has a lot of functions related to trigonometric function. It can be said that the entire MSP is based on this.
But in this demo I use Max Jitter to visualize trigonometric function, and does not use MSP.

Max has a lot of subsets features, the most famous of which is the sound-related MSP, and the graphic and image is Jitter.
In fact, the official name is now Max, but the early name of MaxMSP is too representative, and the title of this article also uses MaxMSP.

At first I felt it would be a very simple stuff. But It took a few hours in total. I feel that I learn Max just like water in drops, while like spring water when forgetting.

The implemented patch is following:

max-screenshot

Some Max clips I referenced a great video tutorial series:
Amazing Max/Msp Tutorial
https://www.youtube.com/watch?v=HN8nQ_KtG6k

The general idea is to use jit.gen to operate jit.matrix, the trigonometric logic is written in jit.gen, and then the last transformed matrix is drawn with jit.mesh.

In short, to put an elephant into a refrigerator, there are only three steps: open the door, put it, and close the door! LOL~

Final Effect:

trig-max-visualization
Very simple effect, the original plan is really more complicated than this. . .

Talk is cheap. Show me the money code!

This demo and the “Coding Druid” series are open source:
https://github.com/avantcontra/coding-druid

You can find more resources in my Patreon. Your encouragement is my driving force!
https://www.patreon.com/avantcontra

Cheers~

Contra

Fb/Tw/Ins/Github: @avantcontra
Website: floatbug.com