How to test if a point is inside of a convex polygon in 2D integer coordinates?

后端 未结 8 710
青春惊慌失措
青春惊慌失措 2020-11-30 04:05

The polygon is given as a list of Vector2I objects (2 dimensional, integer coordinates). How can i test if a given point is inside? All implementations i found on the web fa

8条回答
  •  情话喂你
    2020-11-30 04:52

    Or from the man that wrote the book see - geometry page

    Specifically this page, he discusses why winding rule is generally better than ray crossing.

    edit - Sorry this isn't Jospeh O'Rourke who wrote the excellent book Computational Geometry in C, it's Paul Bourke but still a very very good source of geometry algorithms.

提交回复
热议问题