Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PShape.PATH not working with P2D renderer. #6009

Closed
ovalnine opened this issue Mar 20, 2020 · 2 comments
Closed

PShape.PATH not working with P2D renderer. #6009

ovalnine opened this issue Mar 20, 2020 · 2 comments

Comments

@ovalnine
Copy link

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
@benfry
Copy link
Contributor

benfry commented Dec 22, 2021

Resolved for Processing 4.0 beta 3 with processing/processing4#316

@benfry benfry closed this as completed Dec 22, 2021
@github-actions
Copy link

This issue has been automatically locked. To avoid confusion with reports that have already been resolved, closed issues are automatically locked 30 days after the last comment. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants