#### Howdy, Stranger!

We are about to switch to a new forum software. Until then we have removed the registration on this forum.

# How to close a "noisy" circular shape?

edited March 2018

Hi everyone !

When trying to draw a noisy circle I'm facing the following problem: the last vertex and the first vertex don't share the same position (due to the applied noise) so "closing" the circle becomes impossible: How can I fix this ?

``````def setup():
size(600, 600)

def draw():
background(255)

n_points = 300

beginShape()
strokeWeight(4)
for e in range(n_points):
n = noise(map(e, 0, n_points, 0, 3))
x = cos(angle * e) * radius * n
y = sin(angle * e) * radius * n
vertex(width / 2 + x, height / 2 + y)
endShape(CLOSE)
``````
Tagged:

• Ok, so this snippet below do the trick BUT I still don't really get what I'm doing.

``````    def setup():
size(600, 600)

def draw():
background(255)

n_points = 300
t = .8

beginShape()
strokeWeight(4)
for e in range(n_points):
x = cos(angle * e) * radius
y = sin(angle * e) * radius
p = PVector(x, y).normalize()
n = map(noise(p.x + t, p.y + t), 0, 1, 70, 120)
p.mult(n*2)
vertex(width / 2 + p.x, height / 2 + p.y)
endShape(CLOSE)
``````

(Click here to see the motion generated by the noise) I've recently purchased the amazing "Generative Design" book by Benedikt Gross and found that he doesn't map the noise like I did in this snippet but rather apply noise to "map" (see first post).

In short, he writes something like:

`noise(map(value,0,range,0,noiseRange)) * someValue`

`map(noise(x, y), 0, 1, min, max)`

Can someone please explain me the difference here ? And why this difference prevented me to close the first circle ?

Thank you.

• I think the thing to focus on is how you get Perlin noise to give you repeating values. That's what you want -- a wobbly line that begins at the same height it ends, so that when wrapped in a circle there is no gap.

The basic answer to this question is that it is the ratio of period to octaves that gives you a repeating pattern. In 2D, it creates a "tile" that seemlessly matches its neighbors; in 1D it creates a wrapping line (or a circular outline).

Here is an in-depth discussion of how noise settings affect the way that Perlin noise repeats:

Your use of map in `map(noise(x, y), 0, 1, min, max)` seems like it might be the equivalent to Gross's use of `someValue` -- it is for scaling the output: