i have a list of points. i connect those points trough lines, so i get an area. now i want to check if another point is within the area of the connected points or not. any ideas how this could be solved.
here is a my code example so far:
here is a my code example so far:
SuperStrict Graphics 640,480,0,60 Global Path:TPath = New TPath Path.AddPoint(630,336) Path.AddPoint(610,337) Path.AddPoint(211,382) Path.AddPoint(544,439) Path.AddPoint(630,466) Local check:Byte While (Not KeyDown(KEY_ESCAPE)) Cls Path.DrawPoints() If MouseHit(1) Then check = Path.IsPointInsideArea(MouseX(),MouseY()) If check Then DrawText("TRUE",10,10) Else DrawText("FALSE",10,10) Flip Wend Type TPoint Field x:Int, y:Int End Type Type TPath Field Points:TList Method New() Points = CreateList() End Method Method IsPointInsideArea:Byte(x:Int, y:Int) ' ' how to check??? ' End Method Method AddPoint(x:Int, y:Int) Local p:TPoint = New TPoint p.x = x p.y = y ListAddLast(Points,p) End Method Method DebugPoints() For Local p:TPoint = EachIn Points DebugLog p.x+"/"+p.y Next End Method Method DrawPoints() Local ox:Int, oy:Int ox=-1 oy=-1 Local fx:Int, fy:Int For Local p:TPoint = EachIn Points If ox=-1 Then fx=p.x ; fy=p.y If ox>-1 Then DrawLine ox,oy,p.x,p.y ox = p.x oy = p.y Next DrawLine ox,oy,fx,fy End Method End Type