We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Having and array of (random) PVectors, I want to concatenate 2 more "PVector" elements with fixed values. The thing is that I can not make it work with "concat" method for resizing the array.. what am I doin´wrong? thx!
class Agent {
PVector a;
Agent(){
a=new PVector(random(width),random(height));
}
}
// blabla
Agent [] a= new Agent(50);
PVector [] total;
PVector fixed1;
PVector fixed2;
//"solution1"
total=a.concat(fixed1,fixed2);
//"solution2"
PVector [] fixedValues ={ fixed1, fixed2}
total=a.concat(fixedValues);
Answers
concat() demands 2 arrays of the same compatible type:
https://Processing.org/reference/concat_.html
You may try out append() instead:
https://Processing.org/reference/append_.html
Or even better, go w/ ArrayList:
https://Processing.org/reference/ArrayList.html
Tried out with ArrayList() as well. The idea is to have a sketch with a "repelling core" and 2 ArrayLists of PVectors: 1 with random values and another one with fixed values. Got a Null pointer exception in line 114:(??) :-w
You should have initialized loc on line 42.
Was it a typing error?
thx for ur tip Lord_of_the_galaxy unforgivable mistake from my side :-??
OK, good.