diff --git a/.gitignore b/.gitignore index 46d0f1e..6b2ea0a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,3 @@ *.jl.mem docs/build/ docs/site/ -test/test.gds diff --git a/src/render/cpw.jl b/src/render/cpw.jl index 6749368..a6fead5 100644 --- a/src/render/cpw.jl +++ b/src/render/cpw.jl @@ -15,8 +15,8 @@ function render!(c::Cell, f, len, s::Paths.CPW, meta::Meta; kwargs...) ppts = [g.(ppgrid, 1, 1); @view (g.(pmgrid, 1, -1))[end:-1:1]] mpts = [g.(mmgrid, -1, -1); @view (g.(mpgrid, -1, 1))[end:-1:1]] - render!(c, Polygon(ppts), Polygons.Plain(), meta) - render!(c, Polygon(mpts), Polygons.Plain(), meta) + render!(c, Polygon(uniquepoints(ppts)), Polygons.Plain(), meta) + render!(c, Polygon(uniquepoints(mpts)), Polygons.Plain(), meta) end function render!(c::Cell, segment::Paths.Straight{T}, s::Paths.SimpleCPW, meta::Meta) where {T} diff --git a/src/render/render.jl b/src/render/render.jl index 2111fde..91b0974 100644 --- a/src/render/render.jl +++ b/src/render/render.jl @@ -20,3 +20,7 @@ function render!(c::Cell, seg::Paths.Segment, s::Paths.NoRenderDiscrete, meta::M kwargs...) end function render!(c::Cell, seg::Paths.Segment, s::Paths.SimpleNoRender, meta::Meta; kwargs...) end + +function uniquepoints(pts) + return pts[.![i == 1 ? false : (pts[i] ≈ pts[max(1,i-1)]) for i in 1:size(pts,1)]] +end diff --git a/src/render/trace.jl b/src/render/trace.jl index df7d75e..0349f9f 100644 --- a/src/render/trace.jl +++ b/src/render/trace.jl @@ -10,8 +10,7 @@ function render!(c::Cell, f, len, s::Paths.Trace, meta::Meta; kwargs...) mgrid = adapted_grid(t->Paths.direction(r->g(r,-1), t), bnds; kwargs...) pts = [g.(pgrid, 1); @view (g.(mgrid, -1))[end:-1:1]] - - render!(c, Polygon(pts), Polygons.Plain(), meta) + render!(c, Polygon(uniquepoints(pts)), Polygons.Plain(), meta) end function render!(c::Cell, segment::Paths.Straight{T}, s::Paths.SimpleTrace, meta::Meta) where {T}