Closed
Description
Description
PShape.PATH not working with P2D renderer
I was trying PShape.PATH so that I could make use of the contains() method. When using it with the default renderer everything works fine, but when changing to P2D renderer the shape is not drawn nor does the contain() method works.
Steps to Reproduce
PShape heart;
float x;
float y;
void setup () {
size(600, 600);
//noStroke();
//noFill();
strokeWeight(2);
heart = createShape(PShape.PATH);
heart.beginShape();
for (float t = 0; t < 2*PI; t += 0.001) {
x = 240*pow(sin(t),3);
y = 195*cos(t) - 75*cos(2*t) - 30*cos(3*t) - 15*cos(4*t);
//x = 240*cos(t);
//y = 240*sin(t);
heart.vertex(x, y);
}
heart.endShape();
}
void draw() {
clear();
push();
translate(width/2, height/2);
//println(mouseX + " - " + mouseY);
if (heart.contains(mouseX-300, mouseY-300)) {
background(255);
heart.setFill(0);
}
else {
background(0);
heart.setFill(255);
}
shape(heart, 0, 0);
pop();
}
Your Environment
- Processing version: 3.5.4
- Operating System and OS version: Windows 7
Metadata
Metadata
Assignees
Labels
No labels