Storing Point in a variable

Hello All,
Why is the statement below invalid:
float x = point(a,b);
it gives me the error : void cannot be matched with int.(interesting!!) Is it not possible to store a point in a variable? I came across this while trying to generate a group of points using “for” loop and then trying to save them in an array.

point() is there to draw a point

both work also with x,y,z (in 3D). A vector is actually a quite complex mathematical thing, in processing an object that knows also commands.

(In future please post your code as text and not as an image)

Chrisir


PVector[] listPV = new PVector[0];

void setup() {
  size(999, 600);

  // fill listPV
  for (int i=20; i<480; i+= 20) {
    listPV = (PVector[]) append(listPV, new PVector(i, height/2));
  }//for

  // Show listPV
  for (PVector pv : listPV) {
    println (pv);
  }//for 
}//func 

void draw() {
  //
}//func 
2 Likes

Hello @prathmesh, remember that you can always go straight to a function’s description in the Processing’s reference just by doing this on the Sketchbook:

  1. Highlight the function’s name (for instance double click the name).
  2. Open the context menu by right clicking on the function’s name.
  3. Click on “Find in reference”.
3 Likes