vagran / dxf-viewer

DXF 2D viewer written in JavaScript
Mozilla Public License 2.0
310 stars 97 forks source link

[#36] Fix issues of start point edge case #43

Closed dotoritos-kim closed 1 year ago

dotoritos-kim commented 1 year ago

Related comment: https://github.com/vagran/dxf-viewer/issues/36#issuecomment-1500921337

Fix hatch pattern calculator line refinement logic to use more robust way.

More better idea has came. Not use even-odd parity, but use whether each edges are in paths. This method doesn't have to detect singularity that I've mentioned, and more reliable.

For each adjacent intersection pair, if that edge is inside of the polygon, then just included it. Otherwise do not include. This is more computational intensive but it'll be optimized using R-tree later, by not scanning every edges of the path(s).

image

@vagran 's suggested paper was pretty brilliant, but I'm not sure how should I modify that so that it works with multiple polygons (=this.boundaryPaths), not just a single one. And time complexity is same so I just stick to current implementation.