圆的二维位置,用于在 OpenSCAD 中圆角

2D-position of circle, for rounding an angle in OpenSCAD

我知道以下内容:

现在我需要计算绿色圆的中心,使其成为 'tangentize?' 两条蓝线(稍后将与其他形状进行 minkowski'ed 以形成圆角三角形的一个点) .

任何帮助将不胜感激!

所描述示例的代码:

//KNOWNS
P=[-3.0,1.0,0.0];
A1=60; A2=-5;
R=5;

//UNKNOWN
SECRET_CALCULATION = [8.2,4.3,0];//???

//ILLUSTRATION
C0=[0,0,0,1]; C1=[0,1,1,0.3]; C2=[0,1,0,0.4]; C3=[1,0,0,0.4];//Colors
translate(P){
    color(C1) rotate(A1) translate([0,-0.5,0]) square([250,1],0);
    color(C1) rotate(A2) translate([0,-0.5,0]) square([250,1],0);
    color(C2) translate(SECRET_CALCULATION) circle(R);
}


//EXPLANATIONS
color(C0) translate(P) {
    translate(SECRET_CALCULATION){
        translate([0,-0.2,0]) square([R,0.4],0);
        translate([R+1,0,0]) rotate(-90) text(str("R:",R),halign="center",valign="top",0.75);
        translate([0,0.2,0]) text("[x?,y?,0]",halign="center",valign="bottom",0.75);
    }
    rotate(((A1-A2)/2)-90) translate([0,-1,0]) text(str("P: ",P),halign="center",valign="top",0.75);
    rotate(A1) text(str("    A1: ",A1,"°"),halign="left",valign="center",0.75);
    rotate(A2) text(str("    A2: ",A2,"°"),halign="left",valign="center",0.75);
}

圆心在射线A1和A2的平分线上。所以我们可以找到这个平分线的方向

B = (A1 + A2) / 2        = 27.5 here

(但不要忘记角度归一化 - 角度 -5 可能表示为 355 等等)

平分线与A1A2的夹角为

D = (A1 - A2) / 2         = 32.5 here

我们可以看到点C(enter)-T(angentpoint)-P与关系

形成直角三角形
L (P-C, DistAlongBisector) = R / Sin(D) 

所以我们可以找到中心坐标为

 C.X = P.X + Cos(B) * L
 C.Y = P.Y + Sin(B) * L

快速手动检查给出

L=5/Sin(32.5)=9.3
C.X = -3 + Cos(27.5)*9.3 = 5.24
C.Y = 1 + Sin(27.5)*9.3 = 5.3