We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I would like to fill the polygon of red lines by some color. Besides I don't want the color covering the points inside the polygon. Any kind of help will be appreciated, thank you so much!
@calelin -- Re:
I would like to fill the polygon of red lines by some color.
Look at PShape, or use beginShape() / vertext() / endShape() :
Besides I don't want the color covering the points inside the polygon. Any kind of help will be appreciated, thank you so much!
Just draw the polygon first, then the points:
void draw(){ // draw polygon first // then draw points on top of it }
... like this:
void draw() { background(255); // move to center translate(width/2, height/2); // style polygon fill(102); stroke(255); strokeWeight(2); // draw polygon beginShape(); vertex(0, -50); vertex(14, -20); vertex(47, -15); vertex(23, 7); vertex(29, 40); vertex(0, 25); vertex(-29, 40); vertex(-23, 7); vertex(-47, -15); vertex(-14, -20); endShape(CLOSE); // move to upper left corner translate(-width/2,-height/2); // style points fill(255, 0, 0); stroke(0, 0, 255); strokeWeight(1); // draw points for (int i=0; i<30; i++) { ellipse(random(width), random(height), 4, 4); } }
Answers
@calelin -- Re:
Look at PShape, or use beginShape() / vertext() / endShape() :
Just draw the polygon first, then the points:
... like this: