Modifying a grid

Hello,

You also posted here looking for a “U instead of flat”.

You were also asked to format your code there as well.

Here is a good reference:
https://www.processing.org/examples/shapetransform.html
https://processing.org/tutorials/trig/

For the L:
I used 2 loops to draw the grid and swapped the x and z vertex in one of them; you will have to change ranges in the for() loops to get the L.

For the U:
I added sin() values to the z vertex; I used 0 to 15 > 0 to PI (mapped or math) … and I took the sin() of that multiplied by an amplitude and added that to z vertex.

You will have to determine a formula for amp to offset the z from 0 to 15.

To get you started with the U (just one loop):

vertex(vertices[z][x].x, vertices[z][x].y, vertices[z][x].z+amp); 
vertex(vertices[z][x+1].x, vertices[z][x+1].y, vertices[z][x+1].z+amp);

And the result of my efforts:

:)

1 Like