;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ ;+ ; NAME:dessinetri ; ; PURPOSE:dessine la triangulation ; ; CATEGORY:pour comprendre comment ca marche ; ; CALLING SEQUENCE:dessinetri [, tri, x, y] ; ; INPUTS:optionnels ; par defaut on choisit la triangulation qui est utilise pour ; les plots et on la trace aux points definites par vargrid ; ; sinon il faut fournir les tableaux ; tri definissant la triangulation (fournis par triangule.pro ; ou triangulate) ; x et y qui sont les positions de points a laquelle se raporte ; la triangulation (cf. les tableau x et y fournis ds ; triangulate) ; ; KEYWORD PARAMETERS: ; ; All plots or polyfill keywords. ; ; WAIT=x. to call wait x second between each triangle draw. ; ; /ONEBYONE: to draw the triangles one by one ; ; /FILL: to fill the triangles (using polyfill) instead of plotting them ; ; CHANGECOLOR=n. to change the color of each traingle. n colors ; will be used and repeted if necessary. ; ; ; OUTPUTS: ; ; COMMON BLOCKS:common.pro ; ; SIDE EFFECTS: ; ; RESTRICTIONS: ; ; EXAMPLE: ; ; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr) ; ;- ;------------------------------------------------------------ ;------------------------------------------------------------ ;------------------------------------------------------------ PRO dessinetri, tri, x, y, WAIT = wait, ONEBYONE = onebyone, FILL = fill, CHANGECOLOR = changecolor, _extra = ex @common tempsun = systime(1) ; pour key_performance a = '' if n_params() EQ 3 then BEGIN CASE size(x, /n_dimensions)+size(y, /n_dimensions) OF 2:BEGIN nx = n_elements(x) ny = n_elements(y) glam = x#replicate(1., ny) gphi = replicate(1., nx)#y END 4:BEGIN glam = x gphi = y END ELSE:BEGIN dummy = report('x and y inputs of dessinetri must have the same number of dimensions (1 or 2)') return END ENDCASE ENDIF ELSE BEGIN grille,mask,glam,gphi, tri = tri undefine, mask tri = ciseauxtri(tri, glam, gphi) ENDELSE ; IF keyword_set(changecolor) THEN BEGIN oldname = !d.name if !d.name EQ 'PS' OR !d.name EQ 'Z' then BEGIN thisos = strupcase(strmid(!version.os_family, 0, 3)) CASE thisOS of 'MAC': set_plot, thisOS 'WIN': set_plot, thisOS ELSE: set_plot, 'X' ENDCASE ncolors=(!d.n_colors-1) < 255 set_plot, oldname ENDIF ELSE ncolors=(!d.n_colors-1) < 255 color = 1+indgen(changecolor)*(ncolors/(changecolor-1)) ENDIF ELSE color = 0 color = color#replicate(1, n_elements(tri)/3/n_elements(color)+1) ; tempdeux = systime(1) ; pour key_performance =2 for i = 0L, n_elements(tri)/3-1 do begin t = [tri[*, i], tri[0, i]] IF keyword_set(fill) THEN $ polyfill, glam[t], gphi[t], color = color[i], _extra = ex $ ELSE plots, glam[t], gphi[t], color = color[i], _extra = ex IF keyword_set(wait) THEN wait, wait IF keyword_set(onebyone) THEN read, a, prompt = 'press a key' ENDFOR IF testvar(var = key_performance) EQ 2 THEN $ print, 'temps dessinetri: trace des triangles', systime(1)-tempdeux ; if keyword_set(key_performance) THEN print, 'temps dessinetri', systime(1)-tempsun return end