305 |
StretchedCircleFillet f1(node, c1, conn1.a); |
StretchedCircleFillet f1(node, c1, conn1.a); |
306 |
StretchedCircleFillet f2(node, c2, conn2.a); |
StretchedCircleFillet f2(node, c2, conn2.a); |
307 |
|
|
308 |
renderSpan(f1, 1); |
//renderSpan(f1, 1); |
309 |
float ta1 = f1.dirTang.atan(); |
//float ta1 = f1.dirTang.atan(); |
310 |
float ta2 = f2.dirTang.atan(); |
//float ta2 = f2.dirTang.atan(); |
311 |
if(ta2 < ta1) ta2 += 2*M_PI; |
//if(ta2 < ta1) ta2 += 2*M_PI; |
312 |
renderSpan(CircularNodeSpan(node, ta1, ta2), 1); |
//renderSpan(CircularNodeSpan(node, ta1, ta2), 1); |
313 |
renderSpan(f2, -1); |
//renderSpan(f2, -1); |
314 |
|
|
315 |
|
// Find out how close they are. |
316 |
|
if(a2-a1 < M_PI && |
317 |
|
(f1.infillet(f2.conn.dir) || |
318 |
|
f2.infillet(f1.conn.dir))) { |
319 |
|
// Cleaved case |
320 |
|
// Need to construct virtual second connection, with only angle changed |
321 |
|
|
322 |
|
// Width of fillet in radians |
323 |
|
float w1 = normAngle(f1.dirTang.atan() - a1); |
324 |
|
float w2 = normAngle(a2 - f2.dirTang.atan()); |
325 |
|
float maxw = w1 >? w2; |
326 |
|
// Angle between connections |
327 |
|
float ab = a2 - a1; |
328 |
|
|
329 |
|
float fract = (maxw - ab) / maxw; |
330 |
|
float va1 = a2 - maxw; |
331 |
|
float va2 = a1 + maxw; |
332 |
|
|
333 |
|
LinearConnectionHalf vc2(node, va2, d2, th2, 1, lerp(p0.z, p2.z, .5)); |
334 |
|
StretchedCircleFillet vf2(node, vc2, conn2.a); |
335 |
|
|
336 |
|
LinearConnectionHalf vc1(node, va1, d1, th1, -1, lerp(p0.z, p1.z, .5)); |
337 |
|
StretchedCircleFillet vf1(node, vc1, conn1.a); |
338 |
|
|
339 |
|
DBG(dbg_vfillets) << "P cleave: "<< w1<<" "<<w2<<" " |
340 |
|
<< ab<<" "<<fract<<" "<<va1<<" "<<va2<< |
341 |
|
"\n"; |
342 |
|
renderSpan( |
343 |
|
makeLerpFilletSpan( |
344 |
|
makeFilletBlend(f1, vf2), |
345 |
|
f1, |
346 |
|
fract), 1 |
347 |
|
); |
348 |
|
|
349 |
|
renderSpan( |
350 |
|
makeLerpFilletSpan( |
351 |
|
makeFilletBlend(f2, vf1), |
352 |
|
f2, |
353 |
|
fract), -1 |
354 |
|
); |
355 |
|
} else |
356 |
|
renderNormalOrBlend(node, f1, f2); |
357 |
} else if(flags & 16) { // Ellipses |
} else if(flags & 16) { // Ellipses |
358 |
// For now, fix angle of attachment to the given angle |
// For now, fix angle of attachment to the given angle |
359 |
EllipseCircleFillet f1(node, c1, conn1.a); |
EllipseCircleFillet f1(node, c1, conn1.a); |