home/ atoms/ sine-as-variance-function

The sine function produces smooth repeating variance usable as a custom noise alternative

Sine (sin) and cosine (cos) return values between -1 and +1 that vary smoothly and periodically as their angle argument increases. Unlike Perlin noise, sine is fully deterministic and periodic (repeats exactly every 2π radians). This makes it useful as a controlled variance function: y = baseY + sin(angle) * amplitude produces a smooth wave. Composing sine with itself — cubing it (pow(sin(rad), 3)) or mixing with noise — breaks the regularity and produces more complex, less obviously periodic curves. The key insight is that mathematical transformations of simple functions can approximate unpredictability without a noise function.

Examples

Sine curve: y = 50 + (sin(radians(angle)) * 40); — a classic sinusoidal wave. Sine cubed: y = 50 + (pow(sin(rad), 3) * 30); — sharper peaks and flatter troughs. Sine cubed plus noise: y = 50 + (pow(sin(rad), 3) * noise(rad*2) * 30); — breaks the periodicity.

Assessment

Sketch by hand the approximate shape of y = sin(x), y = sin(x)^3, and y = sin(x)^5 for x from 0 to 2π. Explain why raising to higher odd powers pushes the curve toward the extremes.

“Like noise, the trigonometric functions sin and cos also return values that vary smoothly according to arguments you pass to them”
corpus · generative-art-a-practical-guide-using-processing-matt-pears · chunk 19