如何确定一个点(X,Y)是否包含在一个圆的圆弧部分(即一个Pie slice)中? [英] How to determine whether a point (X,Y) is contained within an arc section of a circle (i.e. a Pie slice)?

查看:569
本文介绍了如何确定一个点(X,Y)是否包含在一个圆的圆弧部分(即一个Pie slice)中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想象一个圆圈。想象一下馅饼。想象一下,试图返回一个bool,它决定了X,Y的提供的参数是否包含在其中一个饼片中。



我对弧的了解:



我有CenterX,CenterY,Radius,StartingAngle,EndingAngle,StartingPoint(圆周上的点),EndingPoint(圆周上的点)。

给定X,Y的坐标,我想确定这个坐标是否包含在饼图幻灯片中的任何位置。 解决方案

> 检查:


  1. 从centerX,centerY到X,Y的角度应在start& endangle之间。

  2. 距centerX,centerY到X,Y的距离应小于半径

有你的答案。


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.

What I know about the arc:

I have the CenterX, CenterY, Radius, StartingAngle, EndingAngle, StartingPoint (point on circumference), EndingPoint (point on circumference).

Given a coordinate of X,Y, I'd like to determine if this coordinate is contained anywhere within the pie slide.

解决方案

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.

这篇关于如何确定一个点(X,Y)是否包含在一个圆的圆弧部分(即一个Pie slice)中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆