Surface Manipulation Problem - generating new iteration through variables but will not delete old sets.HELP?
in
Contributed Library Questions
•
1 year ago
I am manipulating geometry with analog input via Arduino [Potenometer]. This is working with the exception of the geometry is being added on top of old sets when ideally I would like it to be visualized as a manipulation of the surface.
I've placed a photo to describe in more detail...
I am new to processing/arduino so please bare with me.
Here is the code:
- import processing.opengl.*;
- import igeo.*;
- import processing.serial.*;
- Serial port;
- float var = 0;
- int rvar = round(var);
- void setup()
- {
- size(500,500, IG.GL );
- port = new Serial(this, "COM3", 9600);
- port.bufferUntil('\n');
- }
- void draw()
- {
- // 4 points in u direction, 3 points in v direction
- double[][][] controlPoints =
- {{{ 0, 0, 0}, { 10, 0, var}, { 20, 0, 0}},
- {{ 0, 10, var}, { 10, 10, var*2}, { 20, 10, var}},
- {{ 0, 20, var}, { 10, 20, var*2}, { 20, 20, var}},
- {{ 0, 30, 0}, { 10, 30, var}, { 20, 30, 0}}};
- // u degree = 3, v degree = 2
- new ISurface(controlPoints, 3, 2).clr(1,.8,0);
- }
- void serialEvent (Serial port)
- {
- var = float(port.readStringUntil('\n'));
- }
1