- Real len = Offset (dx,dy).length ();
- Real gapx = dx * (gap / len);
- Real gapy = dy * (gap / len);
- Real lshortx = dx * (left_shorten / len);
- Real lshorty = dy * (left_shorten / len);
- Real rshortx = dx * (right_shorten / len);
- Real rshorty = dy * (right_shorten / len);
- Axis other = other_axis (protusion_axis);
-
- Molecule l1 = Lookup::line (thick, Offset(lshortx, lshorty),
- Offset ( (dx - gapx)/2, (dy - gapy)/2 ));
-
- Molecule l2 = Lookup::line (thick, Offset((dx + gapx) / 2,(dy + gapy) / 2),
- Offset (dx - rshortx, dy - rshorty));
-
- Offset protusion;
- protusion[other] = -left_widen;
- protusion[protusion_axis] = left_height;
- Molecule p1 = Lookup::line (thick,
- Offset(lshortx, lshorty),
- Offset(lshortx, lshorty) + protusion);
- protusion[other] = right_widen;
- protusion[protusion_axis] = right_height;
- Molecule p2 = Lookup::line (thick,
- Offset(dx - rshortx, dy - rshorty),
- Offset(dx - rshortx, dy - rshorty) + protusion);
-
- Molecule m;
- m.add_molecule (p1);
- m.add_molecule (p2);
- m.add_molecule (l1);
- m.add_molecule (l2);
-
- return m;
-}
+ Drul_array<Offset> corners (Offset (0, 0), dz);
+
+ Real length = dz.length ();
+ Drul_array<Offset> gap_corners;
+
+ Axis bracket_axis = other_axis (protusion_axis);
+
+ Drul_array<Offset> straight_corners = corners;
+
+ Direction d = LEFT;
+ do
+ {
+ straight_corners[d] += -d * shorten[d] / length * dz;
+ }
+ while (flip (&d) != LEFT);