What is the algorithm for finding the center of a circle from three points?(从三个点找到圆心的算法是什么?)
问题描述
我在圆周上有三个点:
pt A = (A.x, A.y);
pt B = (B.x, B.y);
pt C = (C.x, C.y);
如何计算圆心?
在 Processing (Java) 中实现它.
Implementing it in Processing (Java).
我找到了答案并实施了一个可行的解决方案:
I found the answer and implemented a working solution:
pt circleCenter(pt A, pt B, pt C) {
float yDelta_a = B.y - A.y;
float xDelta_a = B.x - A.x;
float yDelta_b = C.y - B.y;
float xDelta_b = C.x - B.x;
pt center = P(0,0);
float aSlope = yDelta_a/xDelta_a;
float bSlope = yDelta_b/xDelta_b;
center.x = (aSlope*bSlope*(A.y - C.y) + bSlope*(A.x + B.x)
- aSlope*(B.x+C.x) )/(2* (bSlope-aSlope) );
center.y = -1*(center.x - (A.x+B.x)/2)/aSlope + (A.y+B.y)/2;
return center;
}
推荐答案
这可能是一个相当深入的计算.这里有一个简单的分步说明:http://paulbourke.net/geometry/circlesphere/.一旦你有了圆的方程,你就可以简单地把它变成一个包含 H 和 K 的形式.点 (h,k) 将是圆心.
It can be a rather in depth calculation. There is a simple step-by-step here: http://paulbourke.net/geometry/circlesphere/. Once you have the equation of the circle, you can simply put it in a form involving H and K. The point (h,k) will be the center.
(在链接处向下滚动一点以获取方程式)
(scroll down a little ways at the link to get to the equations)
这篇关于从三个点找到圆心的算法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从三个点找到圆心的算法是什么?


基础教程推荐
- 降序排序:Java Map 2022-01-01
- 设置 bean 时出现 Nullpointerexception 2022-01-01
- Java:带有char数组的println给出乱码 2022-01-01
- 在 Libgdx 中处理屏幕的正确方法 2022-01-01
- Java Keytool 导入证书后出错,"keytool error: java.io.FileNotFoundException &拒绝访问" 2022-01-01
- 减少 JVM 暂停时间 >1 秒使用 UseConcMarkSweepGC 2022-01-01
- 如何使用 Java 创建 X509 证书? 2022-01-01
- FirebaseListAdapter 不推送聊天应用程序的单个项目 - Firebase-Ui 3.1 2022-01-01
- “未找到匹配项"使用 matcher 的 group 方法时 2022-01-01
- 无法使用修饰符“public final"访问 java.util.Ha 2022-01-01