问题描述
给出3点A,B和C
我如何找到以A开始,以C结束并经过B的弧形;它的中心的坐标,半径和r和r'的角度?
How can I find and arc that begins at A, ends at C and pass through B; its center's coordinates, radius and angles for r and r' ?
推荐答案
有几种方法可以做到这一点.这是一种算法:
There are a few ways to do this. Here is one algorithm:
-
获取您的订单
Get your COORDS
A = {xA,yA}
A = {xA,yA}
B = {xB,yB}
B = {xB,yB}
C = {xC,yC}
C = {xC,yC}
d = {xd,yd}
d = {xd,yd}
计算线AB和BC的中点
Calculate Mid-points of lines AB and BC
mid_AB = {(xA + xB)/2,(yA + yB)/2}
mid_AB = { (xA+xB)/2, (yA+yB)/2 }
mid_BC = {(xB + xC)/2,(yB + yC)/2}
mid_BC = { (xB+xC)/2, (yB+yC)/2 }
找到AB和BC线的斜率
Find slopes of lines AB and BC
slope_AB =(yB-yA)/(xB-xA)
slope_AB = (yB-yA)/(xB-xA)
slope_BC =(yC-yB)/(xC-xB)
slope_BC = (yC-yB)/(xC-xB)
构建从中点到AB和BC的直线(感谢您 Yves 抓住负面因素!)
Construct lines running through mid-points PERPENDICULAR to AB and BC (thank you to Yves for catching the negative!)
Slope_perp_AB =-(slope_AB)^(-1)
Slope_perp_AB = -(slope_AB)^(-1)
Slope_perp_BC =-(slope_BC)^(-1)
Slope_perp_BC = -(slope_BC)^(-1)
***带有Slope_perp_AB的线穿过mid_AB
*** Line with Slope_perp_AB runs through mid_AB
***带有Slope_perp_BC的线穿过mid_BC
*** Line with Slope_perp_BC runs through mid_BC
将两个方程式设置为相等,并求解以找到交点!这给你点d = {xd,yd} !!!
Set the two equations equal to each other and solve to find intersection!This gives you point d={xd,yd} !!!
现在计算半径和角度与中心点d无关紧要!
Calculating the radius and angles is now trivial with the center-point d!
这篇关于查找圆弧的算法,其圆心,半径和角度给定3个点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!