152 |
th = r * thick_t.transform(ZVec(d / r, 0, 0)).x; |
th = r * thick_t.transform(ZVec(d / r, 0, 0)).x; |
153 |
|
|
154 |
a = angle_t.transform(ZVec(d / r, 0, 0)).x; |
a = angle_t.transform(ZVec(d / r, 0, 0)).x; |
155 |
|
|
156 |
|
// XXX: prevent negative stretching by adjusting the "tangent" |
157 |
|
// angles, if necessary |
158 |
|
float t = 0.5 * th; |
159 |
|
float r2 = (d*d+t*t-r0*r0) / (2*r0 - 2*t); |
160 |
|
float at = asin((t + r2) / (r0 + r2)); |
161 |
|
if (a > at) a = at; |
162 |
|
|
163 |
|
// XXX: interpolate angle to zero from the point of |
164 |
|
// "overlap" (i.e., where the beginning and end of the side |
165 |
|
// of a fillet meet) to when the nodes coincide. |
166 |
|
float f = d / r0; |
167 |
|
if (f < 1.0) a = asin(t / r) * sin(M_PI_2 * f); |
168 |
|
|
169 |
DBG(dbg_vfillets) << |
DBG(dbg_vfillets) << |
170 |
format("FilletSpan CONN: r: %s d: %s th: %s a: %s") % |
format("FilletSpan CONN: r: %s d: %s th: %s a: %s") % |
171 |
r% d% th% a; |
r% d% th% a; |
299 |
|
|
300 |
float csize = crad(t0); |
float csize = crad(t0); |
301 |
|
|
302 |
Conn conn1(thick_t, angle_t, t0, t1, d1);//0.5 * (p1 - ctr).length()); |
Conn conn1(thick_t, angle_t, t0, t1, d1); |
303 |
Conn conn2(thick_t, angle_t, t0, t2, d2);//0.5 * (p2 - ctr).length()); |
Conn conn2(thick_t, angle_t, t0, t2, d2); |
|
|
|
|
// XXX: prevent negative stretching by adjusting the "tangent" |
|
|
// angles, if necessary |
|
|
float r = csize; |
|
|
float T1 = 0.5 * conn1.th; |
|
|
float T2 = 0.5 * conn2.th; |
|
|
float R1 = (d1*d1+T1*T1-r*r) / (2*r - 2*T1); |
|
|
float R2 = (d2*d2+T2*T2-r*r) / (2*r - 2*T2); |
|
|
float at1 = asin((T1 + R1) / (r + R1)); |
|
|
float at2 = asin((T2 + R2) / (r + R2)); |
|
|
if (conn1.a > at1) conn1.a = at1; |
|
|
if (conn2.a > at2) conn2.a = at2; |
|
|
|
|
|
// XXX: interpolate angle to zero from the point of |
|
|
// "overlap" (i.e., where the beginning and end of the side |
|
|
// of a fillet meet) to when the nodes coincide. |
|
|
float frac1 = 2 * d1 / (crad(t0) + crad(t1)); |
|
|
float frac2 = 2 * d2 / (crad(t0) + crad(t2)); |
|
|
if (frac1 < 1.0) conn1.a = asin(T1 / r) * sin(M_PI_2 * frac1); |
|
|
if (frac2 < 1.0) conn2.a = asin(T2 / r) * sin(M_PI_2 * frac2); |
|
304 |
|
|
305 |
float th1 = conn1.th; |
float th1 = conn1.th; |
306 |
float th2 = conn2.th; |
float th2 = conn2.th; |