Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 get coordinates of arc's end

If we draw an arc, how can we get coordinates of arc's end (last point) with respect to the center.

like image 816
benjamin54 Avatar asked Sep 09 '12 19:09

benjamin54


1 Answers

See http://jsfiddle.net/5DdQt/

Use

function getPoint(c1,c2,radius,angle){
    return [c1+Math.cos(angle)*radius,c2+Math.sin(angle)*radius];
}
  • c1 and c2 are the coordinates of the center of the arc
  • radius is the arc's radius
  • angle is the last point's angle in radians.

Radians = (degrees * Math.PI) / 180.

like image 69
Oriol Avatar answered Nov 02 '22 02:11

Oriol