Stepping into deep water, need advice
BlitzMax Forums/BlitzMax Programming/Stepping into deep water, need advice
| ||
I am creating a module for a piece of machine vision hardware. I have the dll and a header file and have made progress with accessing simple functions, no problem. Now, there are certain other functions that I need to access but I am unsure of how to deal with them. I can't provide the exact function or much detail about the DLL (NDA) but I'll try and describe what I am seeing. For example there is a function in the header like so: int getposition( float* x, float* y, float* z ); I know that this function provides x,y,z coordinates for a feature in the camera space. From what I can gather, this function takes pointers for parameters, puts the coordinate data into those pointers and then returns an int indicating success or failure. Before I continue with too many silly questions, is my assumption reasonable? Also, how would I translate this function into my mod, is this close? Extern getposition:Int(x:Byte Ptr, y:Byte Ptr, z:Byte Ptr) End Extern |
| ||
Try this:Extern Function getposition:Int(x:Float Ptr, y:Float Ptr, z:Float Ptr) End Extern and to test pass standard BlitzMax float arrays Last edited 2011 |
| ||
Thanks skidracer, the module compiles now. As for the test, I tried this:Local posArray:Float[3] Local p:Float Ptr p = posArray getposition(p[0], p[1], p[2]) Unable to convert from 'Float' to 'Float Ptr' on the function call. Ideas? Last edited 2011 |
| ||
did this, seems to work:Local px:Float Local py:Float Local pz:Float Local x:Float Ptr = Varptr px Local y:Float Ptr = Varptr py Local z:Float Ptr = Varptr pz getposition(x, y, z) |
| ||
At a guess I think the code should possibly look like this? The number 4096 should be set to maximum number of points that getposition is documented to return.Global PX:Float[4096] Global PY:Float[4096] Global PZ:Float[4096] ' scan image local n=getposition(PX,PY,PZ) ' dump results For local i=0 until n DebugLog "Point "+i+":"+PX[i]+","+PY[i]+","+PZ[i] next Last edited 2011 Last edited 2011 |
| ||
The function getposition returns the 3D position of an object of interest, for instance a persons head. Seems like there are a few ways to skin this cat but at least something is working, thanks to your help. |