从一个角度和一定距离的python寻找点
我想在下面找到红点计数。使用Python。我该怎么做?使用给定的角度和根据placemark的距离。
每个点都有坐标(纬度,经度)。 Placemark还具有坐标。
来回示例,您可以使用角度85 dgress,其BeamWitDH可以获取50度。
给定区域中有许多红点。我有一些局限性(角度和距离)。我如何计算红点?
br,
I want to find red points count below picture. Using python. How can I do that? Using given angle, and distance according to placemark..
Every point has coordinate(latitude,longitude). Placemark also has coordinate.
Fro example, You can use angle 85 degress and its beamwitdh can be taken 50 degress.
there are many red dots in given area. I have some limitations (angle and distance). How can I count red dots?
BR,
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题相对含糊,因此我要假设这是一个圆圈。
好吧,使用一些数学,我们可以弄清楚如何获得距离,d和角度,theta,基于x和y坐标的坐标。
我们知道:
x^2 + y^2 = d^2
tan(theta)= y/x
为此背后的实际数学角度theta,斜边长度D,水平长度X和垂直长度y。
解决
theta
和d
:d = sqrt(x^2 + y^2)
theta = theta = arctan(y/x)
我们的算法将列入一个元组列表(表示要点),并查看每个点的角度是否在一定范围内。此外,我们将检查每个点的距离是否小于我们的极限。如果满足这两种情况,那么我们将增加总数。
现在我们知道如何根据距离和角度找到我们的坐标,我们可以轻松地发挥我们的功能:
样本:
输出:
前两个点在0和1.2弧度内的角度和小于4的距离。
请注意:为此功能,我们假设
angle1< Angle2
,如果Angle1
下降到水平轴以下,则为负。如果您的输入的Angle1
为正,但在水平轴以下,则只需将其乘以-1
,然后将其输入到函数中即可。我希望这有所帮助!请让我知道您是否需要进一步的帮助或澄清!
Your question is relatively vague so for the time being I am going to assume that this is a circle.
Well, using some math, we can figure out how to get the distance, d, and angle, theta, coordinates based off of the x and y coordinates.
We know:
x^2 + y^2 = d^2
tan(theta) = y/x
For the actual math behind this, you can draw a right triangle with angle theta, hypotenuse length d, horizontal length x, and vertical length y.
Solving for
theta
andd
:d = sqrt(x^2 + y^2)
theta = arctan(y/x)
Our algorithm will be taking in a list of tuples (to represent points), and seeing if the angle each point makes is within a certain range. Additionally, we will check if the distance each point makes is less than our limit. If both of these conditions are met, then we will increase our total.
Now that we know how to find our coordinates based on the distance and angle, we can easily make our function:
Sample:
Output:
The first two points have an angle within 0 and 1.2 radians and a distance less than 4.
Note: For this function, we are assuming
angle1 < angle2
, and that ifangle1
dips below the horizontal axis, it will be negative. If your input hasangle1
as positive, but is below the horizontal axis, just multiply it by-1
before inputting it into the function.I hope this helped! Please let me know if you need any further help or clarification!