How to determine whether a point (X,Y) is contained within an arc section of a circle (i.e. a Pie slice)?

前端 未结 4 736
面向向阳花
面向向阳花 2020-12-02 19:03

Imagine a circle. Imagine a pie. Imagine trying to return a bool that determines whether the provided parameters of X, Y are contained within one of those pie pieces.

<
4条回答
  •  被撕碎了的回忆
    2020-12-02 19:54

    You have to convert atan2() to into 0-360 before making comparisons with starting and ending angles.

    (A > 0 ? A : (2PI + A)) * 360 / (2PI)

提交回复
热议问题