How to calculate a point with an given center, angle and radius?

前端 未结 3 488
北恋
北恋 2020-12-28 17:09

In this SO question, someone asked for calculating an angle from three points. I need to do the opposite thing.

I want to draw a clock, and I have tiny tick images.

3条回答
  •  遥遥无期
    2020-12-28 17:40

    let a be the angle, (x,y) the center point and r the radius, then your point will be at

    (x + r*cos(a), y + r*sin(a))
    

提交回复
热议问题