Thanks! This has been very useful on a number of projects!
One problem - the function does not handle an empty input array of [2 x 0] and crashes MATLAB. Adding a check of the input dimensionality with a warning if the input is empty and perhaps returning an empty array would be nice.
Very useful. On the examples I have tested, the current mex version of inpoly is about 2 times faster than the *.m file.
26 Jun 2007
sorry for my poor english level skill ...
26 Jun 2007
Yes in fact, I did this mex file a long times ago. I realized that you update the algorithm. Maybe if I had 1 hour, I'll recreate the new version of this mex-file. If not, I'll remove this submission
25 Jun 2007
Well, I guess this is what you get when you "mex" someone else's code...
This mex file is based on an old version of my "inpoly.m" function. Unfortunately for the author I've made significant improvements to the algorithm since then and a different algorithm is used in my new "inpoly.m" function.
This mex file appears to be slower than my new "inpoly.m" function by a factor of between 3 and 4 on the examples I've tested, even though I have still only coded it as a *.m file.
There is also no "help inpoly" available unless you directly open the *.c file and it also seems that the inputs are required to be transposed when compared with the original "inpoly.m" function.
As with all versions/copies of "inpoly" the point of this code is that it's faster than the MATLAB "inpolygon.m" function, especially for large inputs.
03 Sep 2007
New algorithm imcorporated. Speed improvement between 50% up to 100%
03 Oct 2009
- Inputs arguments checking
- Should compile with Linux/GCC
05 Oct 2009
-Inputs arguments checking
-Should compile on Linux
21 Nov 2011
- Add online help
- Cosmetic changes in inpoly.c and demo file