 <p>Take a look at </p> <p><a href="http://www.realtimerendering.com/intersections.html" rel="nofollow">http://www.realtimerendering.com/intersections.html</a></p> <p>Lot of help in determining intersections between various kinds of geometry</p> <p><a href="http://geomalgorithms.com/code.html" rel="nofollow">http://geomalgorithms.com/code.html</a> also has some c++ functions one of them serves your purpose</p>