So Im new to processing and I’m trying to port p5 code.
This is the original p5 code
this.init = function(){
var theta = 360/sides;
for (var i=0;i<sides;i++){
var thetab = theta * i;
var thetac = theta * i+theta;
this.walls.push(true);
this.edge.push([this.x+w/2*sin(thetab),this.y+w/2*cos(thetab),this.x+w/2*sin(thetac),this.y+w/2*cos(thetac)]);
this.vertex.push([this.x+w/2*sin(thetac),this.y+w/2*cos(thetac)]);
this.length = dist(this.x+w/2*sin(thetab),this.y+w/2*cos(thetab),this.x+w/2*sin(thetac),this.y+w/2*cos(thetac));
}
Ive created arraylists to replace the arrays as such in the class outside of the constructor
ArrayList<Boolean> walls =new ArrayList<Boolean>();
ArrayList<Float[]> edge =new ArrayList<Float[]>();
ArrayList<Float> vertex =new ArrayList<Float>();
and am trying to add to them in an amended function like this.
void init(){
float theta = 360/sides;
for (int i=0;i<sides;i++){
float thetab = theta * i;
float thetac = theta * i+theta;
float []a = {x+w/2*sin(thetab),y+w/2*cos(thetab),x+w/2*sin(thetac),y+w/2*cos(thetac)};
walls.add(true);
edge.add( a);
vertex.add(x+w/2*sin(thetac),y+w/2*cos(thetac));
length = dist(x+w/2*sin(thetab),y+w/2*cos(thetab),x+w/2*sin(thetac),y+w/2*cos(thetac));
}
however I get this error.
The method add(int, Float) in the type ArrayList is not applicable for the arguments (float, float)