Skip to content

Commit

Permalink
Merge pull request #287 from GiggleLiu/jg/fix-intersectlines-polysmooth
Browse files Browse the repository at this point in the history
Fix intersect lines and polysmooth function
  • Loading branch information
cormullion committed Nov 9, 2023
2 parents 24b2bf9 + bba8e24 commit 6a795b2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/point.jl
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,9 @@ function ispointonline(pt::Point, pt1::Point, pt2::Point;

# point on the line
if (abs(dxl) >= abs(dyl))
return dxl > 0 ? pt1.x <= pt.x && pt.x <= pt2.x : pt2.x <= pt.x && pt.x <= pt1.x
return dxl > 0 ? pt1.x <= pt.x+atol && pt.x <= pt2.x+atol : pt2.x <= pt.x+atol && pt.x <= pt1.x+atol
else
return dyl > 0 ? pt1.y <= pt.y && pt.y <= pt2.y : pt2.y <= pt.y && pt.y <= pt1.y
return dyl > 0 ? pt1.y <= pt.y+atol && pt.y <= pt2.y+atol : pt2.y <= pt.y+atol && pt.y <= pt1.y+atol
end
end

Expand Down
7 changes: 5 additions & 2 deletions src/polygons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -393,13 +393,16 @@ function polysmooth(points::Array{Point,1}, radius, action::Symbol; debug = fals
# need to close by joining to first point
if close
push!(temppath, temppath[1])
temppath[1] = (:move, temppath[1][2])
else
pushfirst!(temppath, (:line, points[1]))
pushfirst!(temppath, (:move, points[1]))
push!(temppath, (:line, points[end]))
end
# draw the path
for (c, p) in temppath
if c == :line
if c == :move
move(p)
elseif c == :line
line(p) # add line segment
elseif c == :arc
arc(p...) # add clockwise arc segment
Expand Down

0 comments on commit 6a795b2

Please sign in to comment.