PVector Array weirdness
in
Programming Questions
•
2 years ago
I am super confused. I am trying to append a PVector onto a PVector array and the array function does not work. Neither does expand or shorten either.
heres some code for thought. thanks
- PVector[] theLine; //PVector array
- PVector current;
- void setup(){
- size(200,200);
- theLine = new PVector[5]; //five blank spots to start
- current = new PVector();
- }
- void draw(){
- current.x =mouseX; //assign current to mouse locaiton
- current.y = mouseY;
- append(theLine, current); //This doesn't seem to do anything but it should, right?
- expand(theLine,10); // this doesn't work either
- shorten(theLine); // or even this. Something must be totally wrong
- println(current.x + ", " + current.y); // print the mouse location
- println(theLine); // print out the entire array (always prints 4 null)
- }
1