hi all
how to make this shape if any one can help
i found this equation :
centerpoint (x1, y1) and a radius r, the height of the hill at the point (x2, y2) is equivalent to:
how to use it to form this terrain
can and how if i can using it in this code
// Daniel Shiffman
// http://codingtra.in
// http://patreon.com/codingtrain
// Code for: https://youtu.be/IKB1hWWedMk
int cols, rows;
int scl = 20;
int w = 2000;
int h = 1600;
float flying = 0;
float[][] terrain;
void setup() {
size(600, 600, P3D);
cols = w / scl;
rows = h/ scl;
terrain = new float[cols][rows];
colorMode(HSB, 100, 100, 100);
}
void draw() {
flying -= 0.1;
float yoff = flying;
for (int y = 0; y < rows; y++) {
float xoff = 0;
for (int x = 0; x < cols; x++) {
terrain[x/2][y/2] = map(noise(xoff, yoff), 0, 1, -100, 100);
xoff += 0.2;
}
yoff += 0.2;
}
background(0);
// stroke(255);
//noFill();
//noStroke();
translate(width/2, height/2+50);
rotateX(PI/3);
translate(-w/2, -h/2);
for (int y = 0; y < rows-1; y++) {
// beginShape(TRIANGLE_STRIP);
beginShape(TRIANGLE_STRIP);
for (int x = 0; x < cols; x++) {
float z = terrain[x][y];
fill(z+20, 100, 100);
vertex(x*scl, y*scl, z);
float z1 = terrain[x][y+1];
fill(z1+20, 100, 100);
vertex(x*scl, (y+1)*scl, z1);
//rect(x*scl, y*scl, scl, scl);
}
endShape();
}
}
thanks for all