Terrain.js sketch

Here I attempt to create terrain as per Shiffman challenge
Web Editor
Can’t use CLOSE on endShape like in vanilla processing or JRubyArt, adds spurious lines.

yes, the SHAPE starts at x =0 and is a triangle strip and one ROW wide and ends at COLS

a CLOSE command would connect the right end with a triangle to x = 0
that 2 lines to x = 0 is what you see as MESSY

the whole plane consists of ROWS times of that triangle strips

so what ends you would like to connect?

The surface looks jagged (on terrain outline), actually in vanilla processing it looks OK either with or without CLOSE.

experiment again with that CLOSE but use
h = 40;

++ and check out my version https://editor.p5js.org/kll/sketches/S1myrBI5X

1 Like

Here’s my hack of your sketch using hash (I get the impression it runs a bit faster?)

good, https://editor.p5js.org/kll/sketches/S1myrBI5X
has mouse scroll and keyboard [s] UP DOWN
and make the flat waterlevel with constrain

I will have to see what I can do in JRubyArt, where I have Vec3D class that can translate to vertex.