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" |
// XXX: prevent the connection from being thicker than the node |
157 |
// angles, if necessary |
//if (th > 2 * r0) th = 2 * r0; |
158 |
|
|
159 |
float t = 0.5 * th; |
float t = 0.5 * th; |
160 |
|
|
161 |
|
// XXX: prevent the middle of the connection from being |
162 |
|
// thicker than the start by adjusting the "tangent" |
163 |
|
// angle if necessary |
164 |
|
float aw = asin(t / r0); |
165 |
|
if (a < aw) a = aw; |
166 |
|
|
167 |
|
// XXX: prevent negative stretching by adjusting the "tangent" |
168 |
|
// angle, if necessary |
169 |
float r2 = (d*d+t*t-r0*r0) / (2*r0 - 2*t); |
float r2 = (d*d+t*t-r0*r0) / (2*r0 - 2*t); |
170 |
float at = asin((t + r2) / (r0 + r2)); |
float at = asin((t + r2) / (r0 + r2)); |
171 |
if (a > at) a = at; |
if (a > at) a = at; |
172 |
|
|
173 |
// XXX: interpolate angle to zero from the point of |
// XXX: interpolate angle to zero from the point of |
174 |
// "overlap" (i.e., where the beginning and end of the side |
// "overlap" (i.e., where the beginning and end of the side |
175 |
// of a fillet meet) to when the nodes coincide. |
// of a fillet meet) to where the nodes coincide. |
176 |
float f = d / (cos(a) * r0); |
float f = d / (cos(aw) * r0); |
177 |
if (f < 1.0) a = asin(t / r0) * sin(M_PI_2 * f); |
if (f < 1.0) a = aw * sin(M_PI_2 * f); |
178 |
|
|
179 |
DBG(dbg_vfillets) << |
DBG(dbg_vfillets) << |
180 |
format("FilletSpan CONN: r: %s d: %s th: %s a: %s") % |
format("FilletSpan CONN: r: %s d: %s th: %s a: %s") % |