Indiepath Ploy.Mod?

BlitzMax Forums/BlitzMax Programming/Indiepath Ploy.Mod?

Does anyone know if this works with the latest version of Max? I placed the poly.mod in the BlitzMax mod folder and tried to compile with no luck?

Here:

C:\Program Files\BlitzMax\mod\indiepath.mod

There seems to be a problem with Release poly in the following function:

Function Poly_Release(poly:dPoly)
   poly.Destroy
   Release poly
End Function



Compile Error: Subexpression for release must be an integer variable



If not does anyone know of a have to determine if your inside a polygon? Presently, I am using DrawPoly.

Thanks

I got it to work using and include and commenting out the Release. However, I don't think it is what I am looking for? I was tring to determine if a point was inside a polygon. It look like if you create two polygons and one is inside the other and not touching they will not colide?

This might work:

http://www.vb-helper.com/howto_point_in_polygon.html

I thought for a moment tim had a cunning ploy to make money with.

inside poly

Money, me, thought my ears were burning...

Sean, no it won't work - I'll spend some time on it now and see what I can do. (if I can find the original code).

http://indiepath.com/tim/poly.mod.rar

should work ok now and includes that point in poly code.

Thanks

I assume you have to draw at 0,0 for the inside polygon to work? Also, using Blide and I get the following error from time to time when I exit:

Is there a way to fill the iside of the Poly?


See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.InvalidOperationException: The object is currently in use elsewhere.
at System.Drawing.Graphics.Dispose(Boolean disposing)
at System.Drawing.Graphics.Dispose()
at Compona.Windows.Forms.BaseControl.a()
at Compona.Windows.Forms.BaseControl.WndProc(Message& m)
at Compona.Windows.Forms.SyntaxBox.EditViewControl.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/microsoft.net/framework/v1.1.4322/mscorlib.dll
----------------------------------------
BLide
Assembly Version: 1.0.2172.37978
Win32 Version: 1.0.2172.37978
CodeBase: file:///C:/Program%20Files/The%20Factory.ws/BLIde/BLide.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.windows.forms/1.0.5000.0__b77a5c561934e089/system.windows.forms.dll
----------------------------------------
System
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system/1.0.5000.0__b77a5c561934e089/system.dll
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 7.0.5000.0
Win32 Version: 7.10.6001.4
CodeBase: file:///c:/windows/assembly/gac/microsoft.visualbasic/7.0.5000.0__b03f5f7f11d50a3a/microsoft.visualbasic.dll
----------------------------------------
Compona.SyntaxDocument
Assembly Version: 1.4.11.39926
Win32 Version: 1.4.11.39926
CodeBase: file:///C:/Program%20Files/The%20Factory.ws/BLIde/Compona.SyntaxDocument.DLL
----------------------------------------
System.Drawing
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.drawing/1.0.5000.0__b03f5f7f11d50a3a/system.drawing.dll
----------------------------------------
SandBar
Assembly Version: 1.1.2.0
Win32 Version: 1.1.2.0
CodeBase: file:///C:/Program%20Files/The%20Factory.ws/BLIde/SandBar.DLL
----------------------------------------
SandDock
Assembly Version: 1.0.6.1
Win32 Version: 1.0.6.1
CodeBase: file:///C:/Program%20Files/The%20Factory.ws/BLIde/SandDock.DLL
----------------------------------------
AxInterop.MSScriptControl
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/The%20Factory.ws/BLIde/AxInterop.MSScriptControl.DLL
----------------------------------------
AxInterop.SHDocVw
Assembly Version: 1.1.0.0
Win32 Version: 1.1.0.0
CodeBase: file:///C:/Program%20Files/The%20Factory.ws/BLIde/AxInterop.SHDocVw.DLL
----------------------------------------
Interop.MSScriptControl
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/The%20Factory.ws/BLIde/Interop.MSScriptControl.DLL
----------------------------------------
Interop.SHDocVw
Assembly Version: 1.1.0.0
Win32 Version: 1.1.0.0
CodeBase: file:///C:/Program%20Files/The%20Factory.ws/BLIde/Interop.SHDocVw.DLL
----------------------------------------
Accessibility
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.573
CodeBase: file:///c:/windows/assembly/gac/accessibility/1.0.5000.0__b03f5f7f11d50a3a/accessibility.dll
----------------------------------------
Compona.SyntaxBox
Assembly Version: 1.4.11.39929
Win32 Version: 1.4.11.39929
CodeBase: file:///C:/Program%20Files/The%20Factory.ws/BLIde/Compona.SyntaxBox.DLL
----------------------------------------
Compona.CoreLib
Assembly Version: 1.0.6.39920
Win32 Version: 1.0.6.39920
CodeBase: file:///C:/Program%20Files/The%20Factory.ws/BLIde/Compona.CoreLib.DLL
----------------------------------------
System.Web
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2037
CodeBase: file:///c:/windows/assembly/gac/system.web/1.0.5000.0__b03f5f7f11d50a3a/system.web.dll
----------------------------------------
System.Xml
Assembly Version: 1.0.5000.0
Win32 Version: 1.1.4322.2032
CodeBase: file:///c:/windows/assembly/gac/system.xml/1.0.5000.0__b77a5c561934e089/system.xml.dll
----------------------------------------

************** JIT Debugging **************
To enable just in time (JIT) debugging, the config file for this
application or machine (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the machine
rather than being handled by this dialog.



Here is my code:

Strict

' A TEST OF THE INDIEPATH.POLY COLLISION LIBRARY WHICH IS BASED ON nPoly BY GoSsE Korupted

'Framework BRL.basic
Import indiepath.poly

Global FPS, RFPS,LastSEcs

' Create a Polygon called ship
Local ship:dPoly = dPoly.Create()

dPoly.Poly_AddVertex(ship,0,-5)
dPoly.Poly_AddVertex(ship,1,-1)
dPoly.Poly_AddVertex(ship,5,0)
dPoly.Poly_AddVertex(ship,1,1)
dPoly.Poly_AddVertex(ship,0,5)
dPoly.Poly_AddVertex(ship,-1,1)
dPoly.Poly_AddVertex(ship,-5,0)
dPoly.Poly_AddVertex(ship,-1,-1)
dPoly.Poly_AddVertex(ship,0,-5)

dPoly.Poly_Resize(ship,10,10)
Local ship1:dPoly = dPoly.Poly_Copy(ship)
dPoly.Poly_Resize(ship1,7,7)
Local ship2:dPoly = dPoly.Poly_Copy(ship1)
dPoly.Poly_Resize(ship2,5,5)

Graphics 800,600,16,85
 
While not KeyHit(KEY_ESCAPE)

	Cls
	SetScale 1.0,1.0
	SetLineWidth(1.4)

	dpoly.Poly_Turn(ship,0.5)

	While dPoly.Poly_Overlap(ship,100,100,ship1,165,100) 
		dpoly.Poly_Turn(ship1,-.1)
		While dPoly.Poly_Overlap(ship1,165,100,ship2,210,100) 
			dpoly.Poly_Turn(ship2,.1)
		Wend
	Wend

	SetColor(0,0,255)
	
	'	If dPoly.Poly_Overlap(ast1,ast1.x,ast1.y,ship1,MouseX(),MouseY()) Then DrawText ("Asteroid",400,300)
	
	'	Asteroid.Update()
	dpoly.Poly_Draw(ship,100,100,0,255,0) 
	dpoly.Poly_Draw(ship1,165,100,255,0,255)
	dpoly.Poly_Draw(ship2,210,100,0,255,255)

	Local bStatus:Int 

	dpoly.Poly_Draw(ship2,MouseX(),MouseY(),0,255,255)	
	bStatus = dpoly.InsidePoly(ship1,MouseX(),MouseY()) 
	DrawText(bStatus, 20, 400)  
	
	If bStatus = True
		DrawText("Inside Polygon!", 20, 420)
	End If
		
	Flip

Wend
End


The error has nothing to do with my module, it looks GUI or BlIDE specific.

Yes, it's possible to have filled polygons, use the native DrawPoly command. if you want textured polys use my Textured Poly module.