I'm having trouble with accessing pointInPoly function after changing my
type structure:
'Type pt2d
' x As Integer
' y As Integer
'End Type
'Dim As Integer x,y
'Dim Shared As pt2d poly(20)
Type Poly
Dim PolyName As String
Dim PolyX(0 To 10) As Integer
Dim PolyY(0 To 10) As Integer
Dim numOfFaces As Integer
End Type
Dim Shared As Poly PolyArray()
Redim PolyArray(0 To 10)
Function ptinpoly(npol As Integer,pv As pt2d Ptr , p1 As pt2d) As Integer
Dim As Integer i, j, c
c=0
For j=0 To npol-1
i=iif(j=npol-1,0,j+1 )
If ((((pv[i].y<=p1.y) And (p1.y<pv[j].y)) Or ((pv[j].y<=p1.y) And _
(p1.y<pv[i].y))) And (p1.x < (pv[j].x - pv[i].x) * _
(p1.y - pv[i].y) / (pv[j].y - pv[i].y) + pv[i].x)) Then c = Not c
Next
Return c
End Function
....
If ptinpoly(4,@[EMAIL PROTECTED]
(0),polyArray(4)) = -1 Then
Print "point is inside polygon!"
End If
As you can see, I gave up older p2td -type and wrote new "poly" type.
All my polygons have only four points currently, so thats why I'm using
4 as static pointer for pointInside -function.
How should I change my code so that I can pass polygons X/Y info for
pointInPoly function. What changes are needed for function to work once
more?
Force is not strong enough yet on This One... I would greatly
appriaciate solution for this simple, but yet annoying problem :)


|