Using void in PGraphics

Hello,

I have this section of code here

void myArc(float cx, float cy) 
{
  float r = size / 2;
  float yOffset = (4*r) / (3*PI);
  
  circles.beginDraw();
  circles.pushMatrix();
  circles.translate(cx, cy - yOffset);
  circles.arc(0, 0, size, size, 0, PI, CHORD);
  circles.popMatrix();
  circles.endDraw();
  
  pushMatrix();
  translate(cx, cy - yOffset);
  arc(0, 0, size, size, 0, PI, CHORD);
  popMatrix();
}

but when I try to put it in my PGraphics layer, it doesn’t work

circles.beginDraw();
    circles.noStroke();
    circles.fill(col);
    circles.myArc(mouseX, mouseY);
    circles.endDraw();

it says the function myArc doesn’t exist. How do I fix this? (I want to draw myArc on my PGraphics layer)

try
myArc(mouseX, mouseY);
only

It works, but does not have the intended effect. In my full code, I want to only draw the arc when the mouse is pressed. This makes it draw when the mouse isn’t pressed.

try:

if(mousePressed){
  myArc(mouseX, mouseY);
}

Please, no need to create duplicates of your posts. For your function to work, you need to provide the exact parameters. You can find the information in the reference. For instance, [here] is the info for arc.

Kf