eightnoteight's blog

By eightnoteight, 4 years ago, In English,

I wrote this convex hull implementation after reading some material on it.

https://gist.github.com/4ab7ef53421fafc12608

output:

but when i change the ccw function from

return ((b[0] - a[0])*(c[1] - a[1]) - (b[1] - a[1])*(c[0] - a[0])) > 0

into

return ((b[0] - a[0])*(c[1] - a[1]) - (b[1] - a[1])*(c[0] - a[0])) >= 0

I am getting incorrect results. output:

I'm changing it to remove collinear points on the convex hull. please help me, thanks in advance.

Read more »

 
 
 
 
  • Vote: I like it  
  • +4
  • Vote: I do not like it