Week 4: Oscillations

Inspiration

My inspiration for this sketch is Memo Akten. However, I also wanted to include something I have seen before. I initially started experimenting with 16 points to create the Tesseract, a 4-dimensional cube. Later I found that to be a bit difficult and moved on to just experimenting with multiple points and connections to create something that has a DNA helix-like structure but also oscillates and moves.

Sketch

Highlight of Code

function generateLayers(n, r) {
  let layerPoints = [];
  let angleStep = TWO_PI / n;  // divide the circle into equal segments
  
  // create points in a circular layout
  for (let i = 0; i < n; i++) {
    let angle = i * angleStep;
    let x = r * cos(angle);
    let y = r * sin(angle);
    layerPoints.push({ x: x, y: y });
  }
  
  points.push(layerPoints);  // add this layer to the points array

  // base case: stop when there's only one point in the layer
  if (n > 1) {
    // recursive call to generate the next layer with half the points and a smaller radius
    generateLayers(floor(n / 2), r * 0.7);  // reduce the radius and number of points for each layer
  }
}

This is the function that generates the layers of points. The function generates circular layers based on the number of layers and the radius of each layer. Changing the radius and the number of points changes the visualization completely

Leave a Reply

Your email address will not be published. Required fields are marked *