X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 02 May 2013 08:14 AM by  anon
Polyfill Speed Increase
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

anon



New Member


Posts:
New Member


--
02 May 2013 08:14 AM
    Hi Everyone, I am trying to increase the speed of a program in which I am using polyfill to plot out radar data range height indicators using elevation and range. Originally I was looping through each individual elevation and range and using polyfill to plot out that individual bin. I am trying to remove one of the FOR loops and pass a 4x500 array of x and y coordinates to polyfill. This has greatly increased the speed, but I am getting artifacts in the data. I am wondering if anyone else has come across this. Some snippets of code are below ;--x=range & y=elevation ;--The *_plus and *_minus are to size the bin to the radar volume a[0,*]=x_minus[*]*cos(y_plus[i]) a[1,*]=x_minus[*]*cos(y_minus[i]) a[2,*]=x_plus[*]*cos(y_minus[i]) a[3,*]=x_plus[*]*cos(y_plus[i]) b[0,*]=sqrt(x_minus[*]^2.+erad^2.+ $ 2*x_minus[*]*erad*sin(y_plus[i]))-erad b[1,*]=sqrt(x_minus[*]^2.+erad^2.+ $ 2*x_minus[*]*erad*sin(y_minus[i]))-erad b[2,*]=sqrt(x_plus[*]^2.+erad^2.+ $ 2*x_plus[*]*erad*sin(y_minus[i]))-erad b[3,*]=sqrt(x_plus[*]^2.+erad^2.+ $ 2*x_plus[*]*erad*sin(y_plus[i]))-erad dummy=REBIN(image[i,*],[4,N_ELEMENTS(x)]) polyfill,a,b,color=dummy,/data I tried attaching some images, but was denied. Any insight would be greatly appreciated! Thank you, Adam

    Deleted User



    New Member


    Posts:
    New Member


    --
    08 May 2013 10:11 AM
    I should note that a[#,*] and b[#,*] are my x,y vectors for creating a box with polyfill. The more I work with this, the more it looks like it is possibly just an issue of the polyfill trying to close the vectors, which cause overlying streaks in the image. Investigation continues...

    Deleted User



    New Member


    Posts:
    New Member


    --
    06 Feb 2014 03:32 PM
    I don't know if this will be very helpful but I think it is a cool piece of information that I wanted to pass along. If you use the IDL 8 Graphics function POLYGON or the graphics object IDLGRPOLYGON (instead of POLYFILL), you can pass information about separate polygons into the same data set and use the CONNECTIVITY keyword to specify which data points should be connected. If you use this method, then you do not have to loop through the data, and render each polygon separately. An example of this is shown below: pro polygon_test_time compile_opt idl2 x1 = [1,1,3,3] y1 = [1,4,4,1] x2 = [1,1,3,3] y2 = [6,10,10,6] x3 = [2,2,4,4] y3 = [3,8,8,3] xx = [1,1,3,3,1,1,3,3,2,2,4,4] yy = [1,4,4,1,6,10,10,6,3,8,8,3] conn = [4,0,1,2,3,4,4,5,6,7,4,8,9,10,11] plo = plot(findgen(12),findgen(12),/NODATA) pol = polygon(xx,yy,CONNECTIVITY=conn, /data, FILL_COLOR='light blue') end
    You are not authorized to post a reply.