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

前端 未结 4 735
面向向阳花
面向向阳花 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:45

    Check:

    1. The angle from the centerX,centerY through X,Y should be between start&endangle.
    2. The distance from centerX,centerY to X,Y should be less then the Radius

    And you'll have your answer.

提交回复
热议问题