designcoding
About Table of Contents Keywords Monthly Archive
Support designcoding!

Generating Harmonic Motion

September 21, 2026 | Algorithms
#fourier #grasshopper #harmonic #rhino-python

While trying to program the curves produced by Spirograph toys in Grasshopper, I took a slightly different path. The topic eventually led to a broader heading: harmonic motion, and from there, to the Fourier Series we looked at previously. This simple Python code models Fourier Synthesis, driven by circles of different radii in a very straightforward way. The Python component sets up a loop that calculates the effect of each circle to the x and y values, individually. In this loop, the angle of each circle at a given time t (provided as input) is calculated. You can enter the radii of however many circles you want sequentially into the list in the r input. The f input gives the rotation frequency of the circles, so this value is multiplied by t to find the angle at a specific moment. The p list represents the phase, allowing us to change the initial angle values of the circles. Ultimately, after calculating an angle value for each circle, the cosine and sine of this value are added to our x and y coordinates. This process is repeated for all circles, until we find the total x and total y values. Let’s check a few different results:

Generating Harmonic Motion animation
import math
from Rhino.Geometry import Point3d, Polyline
pts = []
t = 0.0
while t < T:
    x = 0.0
    y = 0.0
    for i in range(len(r)):
        angle = f[i] * t + p[i]
        x += r[i] * math.cos(angle)
        y += r[i] * math.sin(angle)
    pts.append(Point3d(x, y, 0))
    t += step
path = Polyline(pts)
Generating Harmonic Motion Grasshopper definition

If you examine it a bit, some of the results resemble the path followed by a weight hanging from the ceiling as it swings like a pendulum. This has been the simplest and most fundamental method I’ve achieved in this field so far. By solving the loop inside the Python component, there was no need to use an add-on. My technical knowledge on this subject is very limited. We can continue reading about this topic under headings like Additive Harmonic Synthesis or Fourier Synthesis. However, we have revisited the Fourier Series we looked at earlier in a much simpler, but less visual way. Be careful about the step input: if you make it too small, your computer can freeze.

Grasshopper definition (GH)Download

Cite this post

Yazar, T. (2026, September 21). Generating Harmonic Motion. designcoding. Retrieved September 21, 2026, from https://www.designcoding.net/generating-harmonic-motion/

Related Posts

Discrete Fourier Transform

May 8, 2025

The Fourier Transform is a powerful mathematical technique that allows us to analyze the different frequency components within a signal or shape. Its discrete version, the Discrete Fourier Transform (DFT), is used when working with numerical data. I studied the Fourier Series here before. One of the most fascinating aspects of the DFT is that it can represent a signal or shape using rotating circles (or vectors). Each circle corresponds to a specific frequency, amplitude, and phase. When connected in…

Fourier Series

November 14, 2022

This is my first experiment with the Fourier Series in Grasshopper using Python. This is a technique to decompose functions into their frequency components. Fourier series have a wide range of applications in physics and engineering. What makes it especially fascinating, however, is the visual intuition it offers. It looks like a kind of mathematical “magic” that emerges from the geometry of frequency. I explored several excellent visual explanations online, including those by Coding Train, 3Blue1Brown, and Mathologer, each offering…

Flow Map on Terrains

September 11, 2026

We previously looked at the terrain generator script we used in projects with first-year architecture students over here. Later on, we added a few analysis modules to this tool. You might remember the slope analysis tool from this link. Today’s topic is another type of analysis: flow. The idea for this code wasn’t actually mine; I developed it by looking at an existing script based on Serkan Uysal’s suggestion. Unfortunately, I don’t know who originally wrote it. Keeping track of…

Dual Polyhedra in Grasshopper

October 7, 2025

Exploring dual polyhedra in Grasshopper is an interesting topic. In this post, I try to generate the dual of any polyhedron using Rhino Python and possibly Grasshopper. I developed this code for Rhino Python earlier here, and now I have converted it into a Grasshopper-Python component for better usability. I start the process by breaking the polyhedron into individual faces and gathering the corner points of each face. These points become the vertices of the dual polyhedron. Then, for each…

String Art in Rhino Python

June 19, 2025

String art is a cool art technique that combines geometry and aesthetics to recreate images using lines between pins. Here is a good reference to start studying it. In this post, I explored a custom Rhino Python script designed for Rhinoceros 7 and 8. It transforms a grayscale image into a dense web of threads. The algorithm analyzes the darkest areas of the image and connects pins in a circular layout to form compositions. The script begins by converting a…

  • Chapters

    • Algorithms
    • Discourses
    • Fabrications
    • Studios
  • Explore

    • All Keywords
    • Table of Contents
    • Monthly Archive
    • #polyhedra
    • #design-education
    • #robot
    • #terrain
    • #tessellation
    • #kuka-prc
    • #parametric-surface
    • #parametric-curve
    • #computational-geometry
    • #visualization
    • #dual
    • #parakeet
    • #pattern
    • #simulation
    • #vector-field
    • #growth
    • #boolean
    • #linear-algebra
    • #sandblasting
    • #stone
  • Search

  • Support designcoding!

  • Enjoying designcoding? Support me on Patreon to keep it growing. Thank you!

  • copyright 2026 designcoding.net | about | privacy policy | end user license agreement