给定起点、终点和(圆的)中心点,查找圆弧的中点 [英] Find arc's mid-point given start, end, and center (of circle) points

查看:101
本文介绍了给定起点、终点和(圆的)中心点,查找圆弧的中点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找有关如何找到圆弧中点的帮助.我有起点和终点、圆心和半径.我在网上到处搜索,找不到可以在任何地方转换为代码的答案.如果有人有任何想法,请告诉我.下图是我试图找到的(假设已经找到圆心).

I'm looking for some help on how to find an arc's mid-point. I have the start and end points, center of circle, and radius. I've searched everywhere online and cannot find an answer that I can convert into code anywhere. If anyone has any ideas, please let me know. The following picture is what I'm trying to find (assume that the center of the circle is already found).

推荐答案

x1,x2 的平均值和 y1,y2 的平均值的 Atan2() 给出到中点的角度.因此,圆弧的中点为:

Atan2() of the mean of x1,x2 and the mean of y1,y2 gives you the angle to the mid point. The mid point at the arc is therefore found as:

double c=Math.Atan2(y1+y2, x1+x2);
double x_mid=R*Math.Cos(c);
double y_mid=R*Math.Sin(c);

请注意,我从 Atan2 的两个参数中删除了 1/2(平均值)的因子,因为这不会改变角度.

Note that I removed the factor of 1/2 (for the mean) from both arguments to Atan2 since that does not change the angle.

更新:此方法将始终在周长上两点之间的最短弧上找到中点.这可能是您需要的,也可能不是.

Update: that this method will always find the mid point on the shortest arc between the two points on the perimeter. That may or may not be what you need.

这篇关于给定起点、终点和(圆的)中心点,查找圆弧的中点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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