so i found a “solution” and its work:
public void grow(Grass g){
int totalchamp = 50;
//champi.addAll((new Grass(parent, position)).grass);
while(champi.size() < totalchamp){
PVector champis = new PVector();
champis.x = parent.random(250, 1750);
champis.y = parent.random(250, 1750);
boolean overlapping = false;
for(int i = 0; i < champi.size(); i++){
PVector other = champi.get(i);
float d = PApplet.dist(champis.x, champis.y, other.x, other.y);
if(d < 32){
overlapping = true;
break;
}
}
ArrayList<PVector> grass = g.getGrass();
for(int a = 0; a < grass.size(); a++){
PVector other = grass.get(a);
float d = PApplet.dist(champis.x, champis.y, other.x, other.y);
if(d < 32){
overlapping = true;
break;
}
}
if(!overlapping){
champi.add(champis);
}
}
}
i call the grass list and then i check if its overlapp.
But i wonder, is it a good way ?