How do you calculate the end point coordinates for an arc given the center coordinates, radius and sweep angle?

I am working in PHP with some filled arcs and I am having a hard time finding a way to calculate the coordinates for the end point of the arc. I know the coordinates of the center point, radius (width and height are the same), start angle and end angle (as required by php's imagefileldarc () function). From this, how can I calculate the coordinates of the end point for the arc?

I've tried the following formula to no avail:

$end['x'] = cos($Angle) * $Radius + $CenterX; 
$end['y'] = sin($Angle) * $Radius + $CenterY;

      

Many thanks

+3


source to share


1 answer


The fact that you are drawing an arc doesn't really matter. Your calculation will always be:



x = ow (angle) * Ratio + CenterX
y = Sin (angle) * Ratio + centery

+2


source







All Articles