How to create a new formula for a fractal-type image?

102 Views Asked by At

(If this is the wrong place to ask, then PLEASE tell me where to take the question instead of chewing me out over this.)

I have been learning how to write out SVG by hand, and in the process made a pattern that can be replicated inside and outside itself to produce a fractal or fractal-like image. What I'm wanting to know is how to write a formula to generate it procedurally, instead of having to calculate by hand all the time.

Going in or out, the image has square dimensions; for in, the number has to be divisible by 6 and 3; for out, the number needs to be divisible by 6 and 3 again, but also produce a number no smaller than 3 for whole real numbers once divided.

The following is a properly formatted (to my knowledge) HTML document with 3 inline SVG segments that can be saved and looked at. If there's any way to post the saved document, that would be much appreciated.

<!DOCTYPE html>
  <head>
    <style>
      path {fill:none; stroke:black; stroke-width:1 }
      p {text-align:center }
    </style>
    <title>
      Test
    </title>
   </head>
  <body>
    <p>
      <svg width="30" height="30">
        <path d="M 15,0 L 30,15 L 15,30 L 0,15 Z"/>
        <path d="M 15,0 L 25,15 L 15,30 L 5,15 Z"/>
        <path d="M 15,0 L 20,15 L 15,30 L 10,15 Z"/>
        <path d="M 15,5 L 30,15 L 15,25 L 0,15 Z"/>
        <path d="M 15,5 L 25,15 L 15,25 L 5,15 Z"/>
        <path d="M 15,5 L 20,15 L 15,25 L 10,15 Z"/>
        <path d="M 15,10 L 30,15 L 15,20 L 0,15 Z"/>
        <path d="M 15,10 L 25,15 L 15,20 L 5,15 Z"/>
        <path d="M 15,10 L 20,15 L 15,20 L 10,15 Z"/>
      </svg>
    </p>
    <p>
      <svg width="90" height="90">
        <path d="M 45,0 L 90,45 L 45,90 L 0,45 Z"/>
        <path d="M 45,0 L 75,45 L 45,90 L 15,45 Z"/
        <path d="M 45,0 L 60,45 L 45,90 L 30,45 Z"/>
        <path d="M 45,15 L 90,45 L 45,75 L 0,45 Z"/>
        <path d="M 45,15 L 75,45 L 45,75 L 15,45 Z"/>
        <path d="M 45,15 L 60,45 L 45,75 L 30,45 Z"/>
        <path d="M 45,30 L 90,45 L 45,60 L 0,45 Z"/>
        <path d="M 45,30 L 75,45 L 45,60 L 15,45 Z"/>
        <path d="M 45,30 L 60,45 L 45,60 L 30,45 Z"/>
        <path d="M 45,30 L 55,45 L 45,60 L 35,45 Z"/>
        <path d="M 45,30 L 50,45 L 45,60 L 40,45 Z"/>
        <path d="M 45,35 L 60,45 L 45,55 L 30,45 Z"/>
        <path d="M 45,35 L 55,45 L 45,55 L 35,45 Z"/>
        <path d="M 45,35 L 50,45 L 45,55 L 40,45 Z"/>
        <path d="M 45,40 L 60,45 L 45,50 L 30,45 Z"/>
        <path d="M 45,40 L 55,45 L 45,50 L 35,45 Z"/>
        <path d="M 45,40 L 50,45 L 45,50 L 40,45 Z"/>
      </svg>
    </p>
    <p>
      <svg width="270" height="270">
        <path d="M 135,0 L 270,135 L 135,270 L 0,135 Z"/>
        <path d="M 135,0 L 225,135 L 135,270 L 45,135 Z"/>
        <path d="M 135,0 L 180,135 L 135,270 L 90,135 Z"/>
        <path d="M 135,45 L 270,135 L 135, 225 L 0,135 Z"/>
        <path d="M 135,45 L 225,135 L 135,225 L 45,135 Z"/>
        <path d="M 135,45 L 180,135 L 135,225 L 90,135 Z"/>
        <path d="M 135,90 L 270,135 L 135,180 L 0,135 Z"/>
        <path d="M 135,90 L 225,135 L 135,180 L 45,135 Z"/>
        <path d="M 135,90 L 180,135 L 135,180 L 90,135 Z"/>
        <path d="M 135,90 L 165,135 L 135,180 L 105,135 Z"/>
        <path d="M 135,90 L 150,135 L 135,180 L 120,135 Z"/>
        <path d="M 135,105 L 180,135 L 135,165 L 90,135 Z"/>
        <path d="M 135,105 L 165,135 L 135,165 L 105,135 Z"/>
        <path d="M 135,105 L 150,135 L 135,165 L 120,135 Z"/>
        <path d="M 135,120 L 180,135 L 135,150 L 90,135 Z"/>
        <path d="M 135,120 L 165,135 L 135,150 L 105,135 Z"/>
        <path d="M 135,120 L 150,135 L 135,150 L 120,135 Z"/>
        <path d="M 135,120 L 145,135 L 135,150 L 125,135 Z"/>
        <path d="M 135,120 L 140,135 L 135,150 L 130,135 Z"/>
        <path d="M 135,125 L 150,135 L 135,145 L 120,135 Z"/>
        <path d="M 135,125 L 145,135 L 135,145 L 125,135 Z"/>
        <path d="M 135,125 L 140,135 L 135,145 L 130,135 Z"/>
        <path d="M 135,130 L 150,135 L 135,140 L 120,135 Z"/>
        <path d="M 135,130 L 145,135 L 135,140 L 125,135 Z"/>
        <path d="M 135,130 L 140,135 L 135,140 L 130,135 Z"/>
      </svg>
    </p>
  </body>
</html>

Felix