- return Stencil ();
-
- Real len = (to-from).length ();
-
- int n = (int) rint ((len - period * fraction) / period);
- if (n > 0)
- {
- /*
- TODO: figure out something intelligent for really short
- sections.
- */
- period = ((to-from).length () - period * fraction) / n;
- }
- stil = make_dashed_line (thick, from, to, period, fraction);
+ return Stencil ();
+
+ Real len = (to - from).length ();
+ /*
+ Dashed lines should begin and end with a dash. Therefore,
+ there will be one more dash than complete dash + whitespace
+ units (full periods).
+ */
+ int full_period_count =
+ (int) rint ((len - period * fraction) / period);
+ full_period_count = max (0, full_period_count);
+ if (full_period_count > 0)
+ {
+ /*
+ TODO: figure out something intelligent for really short
+ sections.
+ */
+ period = len / (fraction + full_period_count);
+ }
+ stencil = make_dashed_line (thick, from, to, period, fraction);