Open dy opened 6 years ago
Possible corrections:
[ ] detect best number of sections based on line character (tangent stats?)
[ ] detect sections phase shift: vs
[x] exploit symmetry to align opposite direction patterns
[ ] dash pattern length ←→ to min segment length ←→ thickness limitation?
Thanks @dy !
Looks like line coloring is broken though off this branch:
see all image diffs:
Great @dy Much better now: https://github.com/plotly/plotly.js/compare/dima-dash-lines
cc @alexcjohnson any thoughts on Dima's fix here?
Very interesting strategy @dy, I like it! I think 8 patterns is a good compromise between join mismatches and dash pattern misalignment. But I'd make sure we have exact horizontal & vertical patterns, since those are very common cases and we don't want to bias viewers into thinking a horizontal line is slightly tilted
@dy is there any reason why the conflict has not been solved? This is a good idea and would fix plotly problems with dashed/dotted lines.
@etpinard @archmoj is that still of any interest? Should me or @archmoj spend some time merging that? Not sure I'll be able to test against all plotly cases.
This PR resolves https://github.com/plotly/plotly.js/issues/2946 and https://github.com/a-vis/regl-line2d/issues/13. The technique is straight: a segment direction is snapped to one of possible dash pattern directions, by default 8. That gives the following solutions:
3 patterns:
4 patterns:
5 patterns:
6 patterns:
7 patterns:
8 patterns (default):
9 patterns:
10 patterns:
12 patterns:
16 patterns:
20 patterns:
40 patterns:
No snapping:
That is still imperfect - pattern is broken at some joins, but that number of broken joins is reduced from every segment to sufficiently different segments.