91 |
/** The thickness of the connection at the middle. |
/** The thickness of the connection at the middle. |
92 |
*/ |
*/ |
93 |
float t; |
float t; |
94 |
/** Whether we're looking at the clockwise or counterclockwise side. |
/** Whether we're looking at the clockwise (+1) or counterclockwise (-1) side. |
95 |
*/ |
*/ |
96 |
int sign; |
int sign; |
97 |
/** The z coordinate of the middle. |
/** The z coordinate of the middle. |
102 |
// The following data members are derivable from the already mentioned ones. |
// The following data members are derivable from the already mentioned ones. |
103 |
// They are calculated here to be cached. |
// They are calculated here to be cached. |
104 |
|
|
105 |
/** The direction (unit) vector. |
/** The direction (unit) vector of the connection (from the node). |
106 |
*/ |
*/ |
107 |
Vec dir; |
Vec dir; |
108 |
|
|
109 |
/** The normal (unit) vector. |
/** The normal (unit) vector of the connection pointing to the outside. |
110 |
*/ |
*/ |
111 |
Vec norm; |
Vec norm; |
112 |
|
|
183 |
|
|
184 |
x1 = (node.r+r1) * cos(ta); |
x1 = (node.r+r1) * cos(ta); |
185 |
|
|
186 |
dirTang = dirVec(conn.a + conn.sign * tangentAngle); |
dirTang = dirVec(conn.a - conn.sign * tangentAngle); |
187 |
|
|
188 |
} |
} |
189 |
ZVec point(float fract, ZVec *intern = 0) const { |
ZVec point(float fract, ZVec *intern = 0) const { |
219 |
const LinearConnectionHalf &conn; |
const LinearConnectionHalf &conn; |
220 |
float tangentAngle; |
float tangentAngle; |
221 |
|
|
222 |
|
/** Direction vector pointing to the point where the fillet touches the circle |
223 |
|
*/ |
224 |
Vec dirTang; |
Vec dirTang; |
225 |
float dtSign; |
float dtSign; |
226 |
|
|
227 |
Vec ept, eno; |
Vec ept, eno; |
228 |
|
|
229 |
|
/** Lengths of the half axes |
230 |
|
*/ |
231 |
Vec elli; |
Vec elli; |
232 |
|
|
233 |
Vec ey; |
Vec ey; |
261 |
|
|
262 |
ecenter = conn.endPoint - ex; |
ecenter = conn.endPoint - ex; |
263 |
|
|
264 |
dirTang = dirVec(conn.a + conn.sign * tangentAngle); |
dirTang = dirVec(conn.a - conn.sign * tangentAngle); |
265 |
dtSign = conn.sign; |
dtSign = conn.sign; |
266 |
|
|
267 |
/* Now, the ellipse always starts at angle 0. Find |
/* Now, the ellipse always starts at angle 0. Find |
271 |
pt2.x *= elli.y / elli.x; |
pt2.x *= elli.y / elli.x; |
272 |
pt2.y = elli.y - pt2.y; |
pt2.y = elli.y - pt2.y; |
273 |
|
|
274 |
eangle = pt2.atan(); |
eangle = atan2(pt2.x, pt2.y); |
275 |
|
|
276 |
DBG(dbg_fillets) << format("Ellipse: ept: %s, eno: %s, elli: %s, ecenter: %s, " |
DBG(dbg_fillets) << format("Ellipse: ept: %s, eno: %s, elli: %s, ecenter: %s, " |
277 |
"dirtang: %s, dtsign: %s, eangle: %s\n") % |
"dirtang: %s, dtsign: %s, eangle: %s\n") % |