Блог пользователя eightnoteight

Автор eightnoteight, 10 лет назад, По-английски

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.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится