Is there any built in methods for this, or does anyone have some full code for it please?
Currently i’ve got this which uses the Jordan curve theorem (ref):
c=False tot=len(v) k=0 j=tot-1 while k<tot: if ( ((v[k]>y) != (v[j]>y)) and ( x < (v[j]-v[k]) * (y-v[k]<i>) / (v[j]-v[k][I]) + v[k][I]) ): c= not c </i>[/I][/I] j=k k+=1 return c x = 5 # 25 y = 5 verts=[(0,0),(0,10),(10,10),(10,0)] print(pin(x, y, verts))
Yes, the test is a square, but goes to show it’s weaknesses…
I’m just doing an implementation of a ray casting method using the odd-even rule, and probably a winding number method… Any comments on speed, or built in c/c++ functions, etc would be nice.