comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDLgrPolygon unexpected result
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDLgrPolygon unexpected result [message #83377 is a reply to message #83375] Thu, 28 February 2013 05:22 Go to previous messageGo to previous message
lecacheux.alain is currently offline  lecacheux.alain
Messages: 325
Registered: January 2008
Senior Member
Le mercredi 27 février 2013 19:41:58 UTC+1, nata a écrit :
> Hi guys,
>
>
>
> I am trying to create a polygon using the following set of points. I want my IDLgrPolygon to look like the plot so I add some vertices to close the shape.
>
>
>
> I don't understand what is going on here. I cannot get the polygon correctly. What am I missing?
>
>
>
> Thank you in advance for your help,
>
> nata
>
>
>
> x=[0.000,0.019,0.037,0.056,0.074,0.093,0.111,0.130,0.148,0.1 67,0.185,0.204,0.222,0.241,0.259,0.278,0.296,0.315,$
>
> 0.333,0.352,0.370,0.389,0.407,0.426,0.444,0.463,0.481,0.500, 0.519,0.537,0.556,0.574,0.593,0.611,0.630,0.648,$
>
> 0.667,0.685,0.704,0.722,0.741,0.759,0.778,0.796,0.815,0.833, 0.852,0.870,0.889,0.907,0.926,0.944,0.963,0.981,1.000]
>
>
>
> y=[0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.0 02,0.000,0.029,0.037,0.037,0.020,0.019,0.036,0.046,$
>
> 0.044,0.049,0.074,0.147,0.186,0.217,0.262,0.399,0.416,0.411, 0.391,0.577,0.459,0.376,0.318,0.387,0.316,0.431,$
>
> 0.421,0.318,0.413,0.628,0.665,0.541,0.714,0.536,0.594,0.606, 0.437,0.804,0.594,0.629,0.836,0.631,0.827,0.910,1.000]
>
>
>
> PLOT, x, y, /XS, /YS
>
>
>
> N=N_ELEMENTS(X)
>
>
>
> x=[0.,x,x[N-1],0]
>
> y=[0.,y,0.,0.]
>
>
>
> poly=OBJ_NEW('IDLgrPolygon',x,y)
>
> XOBJVIEW, poly

Since your (x,y) curve is increasing from [0,0] to [1,1], you can close it by simply adding the (1,0) point. Try this:

x=[0.000,0.019,0.037,0.056,0.074,0.093,0.111,0.130,0.148,0.1 67,0.185,0.204,0.222,0.241,0.259,0.278,0.296,0.315,$
0.333,0.352,0.370,0.389,0.407,0.426,0.444,0.463,0.481,0.500, 0.519,0.537,0.556,0.574,0.593,0.611,0.630,0.648,$
0.667,0.685,0.704,0.722,0.741,0.759,0.778,0.796,0.815,0.833, 0.852,0.870,0.889,0.907,0.926,0.944,0.963,0.981,1.000]

y=[0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.000,0.0 02,0.000,0.029,0.037,0.037,0.020,0.019,0.036,0.046,$
0.044,0.049,0.074,0.147,0.186,0.217,0.262,0.399,0.416,0.411, 0.391,0.577,0.459,0.376,0.318,0.387,0.316,0.431,$
0.421,0.318,0.413,0.628,0.665,0.541,0.714,0.536,0.594,0.606, 0.437,0.804,0.594,0.629,0.836,0.631,0.827,0.910,1.000]

pl = plot(x, y)
pol = polygon([x,x[-1]],[y,y[0]], /DATA, /FILL_BACKGROUND, FILL_COLOR='grey')

alain.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: ps to jpeg conversion
Next Topic: Re: 3D array imaging with different colors

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 11:53:52 PDT 2025

Total time taken to generate the page: 0.87119 seconds