### Moore curve drawn with epicycles

• 7 Replies
• 901 Views

0 Members and 1 Guest are viewing this topic.

#### Fraktalist

• Strange Attractor
• Posts: 1168

#### Moore curve drawn with epicycles

« on: August 18, 2017, 12:48:45 PM »

« Last Edit: August 18, 2017, 01:46:55 PM by Frank Fraktalist »

#### Softology

• Fractal Phenom
• Posts: 47

#### Re: Moore curve drawn with epicycles

« Reply #1 on: September 02, 2017, 10:25:52 PM »
Interesting.  Previously I have seen the "Fractal Spirographs", ie

https://softologyblog.wordpress.com/2017/02/27/fractal-spirographs/

Your example seems to vary the direction of rotation between circles for different results.  Any more info on these?

#### Fraktalist

• Strange Attractor
• Posts: 1168

#### Re: Moore curve drawn with epicycles

« Reply #2 on: September 02, 2017, 10:31:00 PM »
nope - nothing, I just stumbled upon that gif at reddit...

nice avatar btw!

#### RedshiftRider

• Global Moderator
• Dendritic Entity
• Posts: 183
• Dagomar Schreuder

#### Re: Moore curve drawn with epicycles

« Reply #3 on: September 03, 2017, 11:37:32 AM »
Cool

• 3f
• Posts: 1595

#### Re: Moore curve drawn with epicycles

« Reply #4 on: September 22, 2017, 12:28:08 PM »
I had a go at something inspired by this, animated gif:

Code: [Select]
#include <complex.h>#include <math.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <fftw3.h>int main(){  int width = 0, height = 0;  scanf("P6\n%d %d\n255", &width, &height);  if ('\n' != getchar()) return 1;  int bytes = 3 * width * height;  unsigned char *img = malloc(bytes);  fread(img, bytes, 1, stdin);  int x, y;  for (y = 0; y < height; ++y)  {    for (x = 0; x < width; ++x)      if (! img[((width * y) + x) * 3]) break;    if (! img[((width * y) + x) * 3]) break;  }  int x0 = x, y0 = y;  const int d[8][2] = { { -1, 0 }, { -1, -1 }, { 0, -1 }, { 1, -1 }, { 1, 0 }, { 1, 1 }, { 0, 1 }, { -1, 1 } };  int dir = 0;  double _Complex *fin = fftw_malloc(width * height * sizeof(*fin));  int n = 0;  do  {    for (int ddir = 0; ddir < 8; ++ddir)    {      int dd = (dir + ddir) & 7;      int x1 = x + d[dd][0];      int y1 = y + d[dd][1];      int k = ((width * y1) + x1) * 3;      if (img[k] < 0xFF && img[k+1] < 0xFF)      {        img[k] = 0xFF;        dir = (dd + 5) & 7;        x = x1;        y = y1;        fin[n++] = x + I * y;        break;      }    }  } while (x != x0 || y != y0);  double _Complex *fout = fftw_malloc(n * sizeof *fout);  double _Complex *iin  = fftw_malloc(n * sizeof *iin);  double _Complex *iout = fftw_malloc(n * sizeof *iout);  fftw_plan pf = fftw_plan_dft_1d(n, fin, fout, FFTW_FORWARD, FFTW_ESTIMATE);  fftw_plan pi = fftw_plan_dft_1d(n, iin, iout, FFTW_BACKWARD, FFTW_MEASURE);  fftw_execute(pf);  int k = 0;  for (double m = 1; m <= n/2; m *= pow(2, 1.0/12.0))  {    memset(iin, 0, n * sizeof(*iin));    for (int j = 0; j < m ; ++j)    {      iin[j] = fout[j];      if (j > 0) iin[n-j] = fout[n-j];    }    fftw_execute(pi);    for (int j = 0; j < n ; ++j)    {      iout[j] /= n;    }    char filename[100];    snprintf(filename, 100, "%05d.svg", k++);    FILE *s = fopen(filename, "wb");    fprintf(s, "<?xml version='1.0' encoding='UTF-8'?><!DOCTYPE svg PUBLIC '-//W3C//DTD SVG 1.1//EN' 'http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd'><svg xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='%d' height='%d' viewBox='0 0 %d %d'><rect x='0' y='0' width='%d' height='%d' stroke='none' fill='white' /><path stroke='black' stroke-width='1' fill='none' d='M %f %f L ", width, height, width, height, width, height, creal(iout[0]), cimag(iout[0]));    for (int j = 1; j < n; ++j)      fprintf(s, "%f %f ", creal(iout[j]), cimag(iout[j]));    fprintf(s, "%f %f Z'/></svg>\n", creal(iout[0]), cimag(iout[0]));    fclose(s);  }  printf("P6\n%d %d\n255\n", width, height);  fwrite(img, bytes, 1, stdout);  fflush(stdout);  free(img);  return 0;}
EDIT: seems animgif no worky in the forum (preview is a jpeg, view image in lightbox shows only the first frame in a tiny gif)  so I detached the image

#### v

• Fractal Phenom
• Posts: 48

#### Re: Moore curve drawn with epicycles

« Reply #5 on: November 01, 2017, 05:28:52 PM »
Nice, I think just about any curve can be interpolated with a parametrization consisting of a finite (or infinite) sum of sinusoids.  The author probably has an expression that takes the order of the curve and gives you an expression for a sum of sinusoids with a number of terms corresponding to the order of the fractal, which would be interesting to see.  This begs the question, is the fourier series a fractal in some way?

#### Fraktalist

• Strange Attractor
• Posts: 1168

#### Re: Moore curve drawn with epicycles

« Reply #6 on: November 01, 2017, 08:58:01 PM »
hm. I only know fourier synthesis from music, synthesizers. You use many sinewaves and modify each frequencies volume to simulate certain sounds, even speech.
for those who never heard of this
In my understanding it does the same thing. Different sized circles(sine waves) create different frequencies. As long as every circle has the same volume it is very much like that hilbert-curve (just visualized differently).
But it adds another parameter, volume(circle size) that is changing over time.

Interesting, never thought of it that way.

#### Bill Snowzell

• Fractal Feline
• Posts: 155

#### Re: Moore curve drawn with epicycles

« Reply #7 on: November 11, 2017, 01:27:56 PM »
All the rage in the mid to late 60's...yes I am that old.

http://nathanfriend.io/inspirograph/

### Similar Topics

###### The Koch curve cycle

Started by Nintendokater on Fractal movie gallery

0 Replies
82 Views
April 06, 2020, 09:58:51 AM
by Nintendokater
###### Elliptic curve group operator

Started by gornvix on Fractal Mathematics And New Theories

0 Replies
272 Views
December 31, 2017, 07:03:09 PM
by gornvix
###### HLF ? Math ⇔ Art exhibition - altenerate ways to display Gosper Curve

Started by kram1032 on Share a fractal

1 Replies
778 Views
September 30, 2018, 05:55:38 PM
by Kalter Rauch