Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

examine points which are inside a polygon by GPU

Asked by AP on 11 Nov 2011

Hi All,

Does anyone know how I can speed up inpolygon function by using GPU?

Thanks.

0 Comments

AP

Tags

Products

No products are associated with this question.

1 Answer

Answer by Walter Roberson on 11 Nov 2011

I thought someone asked about this about a week ago, but I cannot find the posting now. The answer was that TriScatteredInterp's routine for checking points in polygons was not designed for GPU use.

Some faster point-in-polygon functions:

http://www.mathworks.com/products/parallel-computing/demos.html?file=/products/demos/distribtb/MapDemo/MapDemo.html

http://www.mathworks.com/matlabcentral/fileexchange/10391-fast-points-in-polygon-test

If, though, as the other person did, you specifically want to test whether a particular point is outside all of the polygons created by TriScatteredInterp, then you would probably have to write the GPU version of the routine yourself.

2 Comments

AP on 12 Nov 2011

I have seen these links. In the first link, the function does not exist in my MATLAB. Is it the case in the version of your MATLAB? Can you call the function like the following:

[in,t] = inpoly(xGrid,yGrid,xv,yv,useGPU)

I am also trying to convert the code in the link http://www.mathworks.com/matlabcentral/fileexchange/10391-fast-points-in-polygon-test to GPU version. Could you please give me some hints?

Walter Roberson on 12 Nov 2011

As the first demo is about mapping, probably inpoly() is part of the mapping toolbox.

I have no experience in writing GPU ccode.

Walter Roberson

Contact us