Path: chuka.playstation.co.uk!news From: Craig Graham Newsgroups: scee.yaroze.programming.3d_graphics Subject: Re: Poly Intersections Date: Mon, 04 Jan 1999 09:37:14 +0000 Organization: PlayStation Net Yaroze (SCEE) Lines: 33 Message-ID: <36908BCA.F33C961E@hinge.mistral.co.uk> References: <3689671E.AA01BBAB@hinge.mistral.co.uk> NNTP-Posting-Host: d2-s39-133-telehouse.mistral.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 4.5 [en] (Win95; I) X-Accept-Language: en Toby Sargeant wrote: > if it's a convex polygon: > > compute intersection of plane. > compute dot product of vector from poly.p1->intersection and poly.p1->poly.p2 > compute dot product of vector from poly.p2->intersection and poly.p2->poly.p3 > if the signs are the same, then the point is inside the polygon. > > if it's not convex, there are more complex algorithms that do this fast, > but I don't know them. Count axis crossing . I got that one to go pretty well. You go round the poly and count the number of times the edges cross the axis' projected out from the point you're testing - if theres an odd number of crossings on each axis, the point is in the poly, if there's an even number, the point is outside. This works on any N sided polygon. > Toby. Star performance - this (and Fred's mail) are the two most techy posts we've had on here in monthes.... Craig.