Skip to content

Commit

Permalink
Filter consecutive, approximately duplicate points.
Browse files Browse the repository at this point in the history
  • Loading branch information
ajkeller34 committed Jul 16, 2018
1 parent 0d05082 commit 4323eb0
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@
*.jl.mem
docs/build/
docs/site/
test/test.gds
4 changes: 2 additions & 2 deletions src/render/cpw.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 4 additions & 0 deletions src/render/render.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 1 addition & 2 deletions src/render/trace.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 4323eb0

Please sign in to comment.