0

I`m confused. I've read a lot of different tutorials related with ray picking. But every time those example are based on some simple shape, square or triangle. In each example for each shape there is a function that is checking this specific shape. How it should be managed without that ? I have different and unnatural shapes, how it can be managed ?

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
Fixus
  • 4,631
  • 10
  • 38
  • 67
  • How accurate does the ray picking need to be? Why can't you use a set of simple shapes for a single odd shape to implement intersection? – Morrison Chang May 29 '17 at 20:56
  • @MorrisonChang for now it is not be very accurate so if you may say something more about your idea that would be great. I'm not sure how can I take an OpenGL object generated from the .obj file and divide to to simple shapes – Fixus May 30 '17 at 16:06

1 Answers1

0

For 2D polygons, I use the Winding number point inside a polygon as described here: http://geomalgorithms.com/a03-_inclusion.html

Near the bottom is C code implementation that is pretty simple to port.

Your polygon hulls are a (closed) list of points.

James Poag
  • 2,320
  • 1
  • 13
  • 20