I have a problem with geomerative and a list of shapes. I think it is trivial, but I don’t understand my error.
If I use this sketch I don’t have any problem.
import geomerative.*;
void setup()
{
size(800, 400);
smooth();
background(255);
noFill();
RG.init(this);
stroke(0);
RShape R = RShape.createRectangle(0, 100, 100, 100);
for (int i = 0; i < 5; i++)
{
R.translate(120, 0);
R.draw();
}
}
void draw() {
}
I obtain the right result
If I use a list with this code, I see only the last item of the list:
import geomerative.*;
ArrayList<RShape> shapeList = new ArrayList<RShape>();
void setup()
{
size(800, 400);
smooth();
background(255);
noFill();
RG.init(this);
stroke(0);
RShape R = RShape.createRectangle(0, 100, 100, 100);
for (int i = 0; i < 5; i++)
{
R.translate(120, 0);
shapeList.add(R);
}
for (int i=0; i<shapeList.size(); i++) {
shapeList.get(i).draw();
}
}
void draw() {
}
The two results.
Where is the problem?