Check if 2D points are clockwise or counterclockwise...
Posted: Fri Sep 12, 2008 9:57 pm
Thanks to eddy I was able to put a map into my small 3D sport program:(demo at http://mr.vogel.googlepages.com/ForerunnerMap.zip)
This is done with the following code lines...
My problem is, to recognize, if the map can be displayed or not. It will be seen, if the corners are in clockwise order (yellow, blue, red green corners). Nothing will be displayed, if the corners are seen like yellow- green - red - blue, but how to check this easily and fast?
This is done with the following code lines...
Code: Select all
;***Google Maps***
;GoogleMapsAvailable=0
If GoogleMapsAvailable
If Start3D()
TransformSprite3D(#GoogleMapSprite,Polygon(0),Polygon(1),Polygon(6),Polygon(7),Polygon(4),Polygon(5),Polygon(2),Polygon(3))
DisplaySprite3D(#GoogleMapSprite,0,0,255)
Stop3D()
EndIf
EndIf
windc=StartDrawing(ScreenOutput())
;***Google Maps***
Box(Polygon(0),Polygon(1),6,6,#Yellow)
Box(Polygon(2),Polygon(3),6,6,#Green)
Box(Polygon(4),Polygon(5),6,6,#Red)
Box(Polygon(6),Polygon(7),6,6,#Blue)
:
:
If GoogleMapsAvailable=0
SelectObject_(windc,winbrush)
Polygon_(windc,@Polygon(),4)
EndIf