views:

84

answers:

1

Hello i am developing a program in c#, and thanks to the matlab .net builder, i am using a matlab maping toolbox fucntion "polybool", which in one of it's options calculate the diffrence of 2 polygons in 2-D. The problem is that the fucntions takes about 0.01 seconds to finish in which is bad for me because i call it a lot. And this doesn't make sense at all bacause the polygons are 5 points each, so there is no way that it take 0.01 second to find the results. Does anyone has any ideas? Thank you

+1  A: 

How are you computing the 0.01 seconds? If this is total operational time, it may very well be the marshaling in and out of the toolbox functionality, which will take some time. The actual routine may be running quickly, but getting your data from C# into the routine, and the results back, will have some overhead involved with the process.

Granted, this overhead probably scales well - since it's most likely (mostly) constant, so if you start dealing with larger polygons, you'll probably see your overall efficiencies scale very well.

Reed Copsey
Right, but large numbers of polygons might not. If polybool executes fast when called from Matlab and slow when called from C#, I'd start looking for a C# or C++ implementation.
Ben Voigt