Hi, here is code to create noise circle using begin and end shape function, if you could help to resolve this question and implement the noise function (with midpoint displacement) to create this circle, and we should not use begin and and end shape
float point = 50;
float rad = 200;
float a , b;
float NoiseValue, NoiseIntensity, NoiseCapacity;
float Time =10;
void setup() {
size(700, 700);
}
void draw() {
background(255);
translate(width/2, height/2);
strokeWeight(3);
NoiseIntensity = map(mouseX, 10, width, 0, 10);
NoiseCapacity = map(mouseY, 10, height, 0.0, 1);
beginShape();
for (float i=0.0; i<=TWO_PI; i+=TWO_PI/point) {
NoiseValue = map(noise( cos(i)*NoiseIntensity+1, sin(i)*NoiseIntensity+1, Time ), 0.0, 1.0, NoiseCapacity, 1);
a = cos(-i)*rad *NoiseValue;
b = sin(-i)*rad *NoiseValue;
vertex(a, b);
}
endShape(CLOSE);
}
Thanks Josephh for your replay ,
Yes my code is working, but again, I need to create circle with noise by [Implementing Midpoint Displacement Algorithm]
For this you need to change the coordinate system you are working in. By default you are in a two dimensional Cartesian coordinate system which specify coordinates with a pair of numbers (x and y).
If you want to convert it into a circle, you need to use Polar coordinates :
Each point is defined by it’s distance to the origin and an angle.
This is the same as your previous code but you need to warp your noise line onto a circle.
The same way you display your line from x = 0 to x = width by dividing the width by the number of points, what do you need to divide in order to display the points around a center point?
How do you get the location of a point on a circle relative to its center and radius?
I don’t know what you call midpoint displacement algorithm but the following result is obtained using a polar coordinate system varying r length at different angle: