Creating Arc if you know center start and end point

Hi all;
This is my first question so apologize if I do not follow the rule properly.

I need to create an arc in processing. but I believe ( maybe I am wrong) the way I wanted the arc function arc( x , y , width , height , start , stop ) does not help me…
here is what I want:

I need to create arc that I know the following information about the arc:
center, radius, start point ( x,y) and (x_end,y_end). and let say we go counterclockwise so the arc to be unique.

is there is anyway to do this efficiently ?

Can you use trigonometry to convert the start and end points into angles?

Hi rebin,

If you want the arc to be circular, you could think of the three points that you know as a triangle. You could then find the circumcircle of the triangle. There is an example of such code at OpenProcessing here.

The center of the circumcircle would not necessarily be the point you label as ‘center’, or even be within the triangle formed by your three points. Nor would the radius of the arc be what you had planned it to be.

Consider the following code, where the distance between the start and center points may not equal the distance between the end and center points.

float startx, starty, endx, endy, centerx, centery, 
  diststart, distend;

void setup() {
  size(200, 200);
  startx = random(0, width);
  starty = random(0, height);
  endx = random(0, width);
  endy = random(0, height);
  centerx = random(width * 0.25, width * 0.75);
  centery = random(height * 0.25, height * 0.75);
  diststart = dist(startx, starty, centerx, centery);
  distend = dist(endx, endy, centerx, centery);

void draw() {
  line(centerx, centery, startx, starty);
  line(centerx, centery, endx, endy);
  ellipse(centerx, centery, diststart, diststart);
  ellipse(centerx, centery, distend, distend);

Instead of drawing the full circumcircle, you could then use arc after you’ve calculated the shortest angular distance. I usually do this when smoothing travel across a circumference over a step in time, so maybe that logic would be helpful.