I didn't saw arrays operations. Since when it's in processing? I missed that... So processing with a slight taste of LISP, hein?
Ok some words on Arrays Vs ArrayLists. Arrays have fixed length and ArrayList could grow. This means that with Arrays, it's difficult to add something to a list. This is why they came with ArrayList, which is more flexible, but slower.
Since Fry is a generous programmer, he had a look to how Arrays manipulations could be simplified. To add an element to an Array, you need to basically create a new Array (longer), copy everything in the new Array and then add the element. This was done with System.arraycopy() (which is Java). This is what append(), expand(), shorten() commands are doing.
Code:PVector v[]; //<--Here, your list is not initialized
Then in your code, when you try to add an element to a list that is not yet initialized, it might be problematic. You should try:
Code:PVector[] v = new PVector[0]; //Empty Array of type PVector
Then also, PVector is not a method, it is an object. You need to place '
new' in front of it:
Code:PVector myVector = new PVector(x, y, z);
So you end up with this:
Code:void gridPointsToPVector(){
PVector[] v = new PVector[0];
for(int i = 0; i < g.length; i++){
if(g[i] == true){
x = i % w;
y = (i / w) % h;
z = i / (w * h);
v = append(v, new PVector(x, y, z));
}
}
}
As said, ArrayList may be usefull as well in your case, but, it is very different.