# More fractals

Posted on 2018-03-09 16:20 in misc

Look at this: https://xomg.net/somenome.html

If your computer isn't very fast, you can use the two sliders "points per iteration" and "iterations to keep".

Adjust the "iterations to keep" so that checking "skip places n-1" is a fast change (or slow if you want it to be).

Adjust the "points per iteration" so that the drawing is bright enough.

then, play with "skip places"

## How it works

```
// generate points
for (var i=0; i < it_points; i++) {
var rpoint = polygon[shaped_chaos(polygon.length)];
px = Math.floor((px + rpoint[0]) / 2);
py = Math.floor((py + rpoint[1]) / 2 * h_mod);
points.push([px, py]);
}
```

draw a point r that is at the middle of r and a random vertex; repeat.

that's it. somenome.html is mostly a wrapper to make it work, and that `shaped_chaos(n)`

function.
It's probably the most interesting and less good-looking part of it.

In the default state, when no effect is applied, `shaped_chaos(n)`

is just a random
number generator with a fancy name,
a wrapper around `Math.random()`

that returns a natural number `[0, n)`

.
That's exactly what's currently happening in the triangle on the left here.

When you you check one of the "skip places n-m" effects, it will try to make the generated number
different from the `n-m`

th iteration's result.

It will try that in a loop and give up skipping things at a default of 10 values.