Blame view

src/idl_misc/JPBLib_for_Dustemwrap/General/curve2polygon.pro 447 Bytes
6db3528a   Jean-Philippe Bernard   adding librairies...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
PRO curve2polygon,x,y,thr,px,py,Npoly=Npoly

mask=1L*y & mask[*]=0L
ind=where(y NE thr)
mask(ind)=1
df=find_ind(mask,1,count=count)
IF count NE 0 THEN BEGIN
  Npoly=(size(df))(1)
  px=ptrarr(Npoly)
  py=ptrarr(Npoly)
  FOR i=0L,Npoly-1 DO BEGIN
     polyx=[x[df[i,0]:df[i,1]],x[df[i,1]],x[df[i,0]],x[df[i,0]]]
     polyy=[y[df[i,0]:df[i,1]],thr       ,thr       ,y[df[i,0]]]
     px[i]=ptr_new(polyx)
     py[i]=ptr_new(polyy)
  ENDFOR
ENDIF

END