source: trunk/SRC/ToBeReviewed/TRIANGULATION/dessinetri.pro @ 163

Last change on this file since 163 was 163, checked in by navarro, 18 years ago

header improvements : type of parameters and keywords, default values, spell checking + idldoc assistant (IDL online_help)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 3.3 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
6; @file_comments
7; Draw the triangulation
8;
9; @categories
10; Utilities
11;
12; @param TRI {in}{optional}
13; Array which define the triangulation (provided by triangule.pro or triangulate)
14;
15; @param X {in}{optional}
16; The x position of points to which the trangulation refer to
17; (see the x array provided in triangulate)
18;
19; @param Y {in}{optional}
20; The y position of points to which the trangulation refer to
21; (see the y array provided in triangulate)
22;
23; @keyword WAIT
24; =x. to call wait x second between each triangle draw.
25;
26; @keyword ONEBYONE
27; To draw the triangles one by one
28;
29; @keyword FILL
30; To fill the triangles (using polyfill) instead of plotting them
31;
32; @keyword CHANGECOLOR
33; =n. To change the color of each triangle. n colors
34; will be used and repeted if necessary.
35;
36; @uses
37; common.pro
38;
39; @history
40; Sebastien Masson (smasson\@lodyc.jussieu.fr)
41;
42; @version
43; $Id$
44;
45;-
46;------------------------------------------------------------
47;------------------------------------------------------------
48;------------------------------------------------------------
49
50PRO dessinetri, tri, x, y, WAIT = wait, ONEBYONE = onebyone, FILL = fill, CHANGECOLOR = changecolor, _extra = ex
51;
52  compile_opt idl2, strictarrsubs
53;
54@common
55   tempsun = systime(1)         ;  For key_performance
56   a = ''
57   if n_params() EQ 3 then BEGIN
58     CASE size(x, /n_dimensions)+size(y, /n_dimensions) OF
59       2:BEGIN
60         nx = n_elements(x)
61         ny = n_elements(y)
62         glam = x#replicate(1., ny)
63         gphi = replicate(1., nx)#y
64       END
65       4:BEGIN
66         glam = x
67         gphi = y
68       END
69       ELSE:BEGIN
70         dummy = report('x and y inputs of dessinetri must have the same number of dimensions (1 or 2)')
71         return
72       END
73     ENDCASE
74   ENDIF ELSE BEGIN
75      grille,mask,glam,gphi, tri = tri
76      undefine, mask
77      tri = ciseauxtri(tri, glam, gphi)
78   ENDELSE
79;
80   IF keyword_set(changecolor) THEN BEGIN
81      oldname = !d.name
82      if !d.name EQ 'PS' OR !d.name EQ 'Z' then BEGIN
83         thisos = strupcase(strmid(!version.os_family, 0, 3))
84         CASE thisOS of
85            'MAC': set_plot, thisOS
86            'WIN': set_plot, thisOS
87            ELSE: set_plot, 'X'
88         ENDCASE
89         ncolors=(!d.n_colors-1) < 255
90         set_plot, oldname
91       ENDIF ELSE ncolors=(!d.n_colors-1) < 255
92       color = 1+indgen(changecolor)*(ncolors/(changecolor-1))
93     ENDIF ELSE color = 0
94     color = color#replicate(1, n_elements(tri)/3/n_elements(color)+1)
95;
96   tempdeux = systime(1)         ; For key_performance =2
97   for i = 0L, n_elements(tri)/3-1 do begin
98      t = [tri[*, i], tri[0, i]]
99      IF keyword_set(fill) THEN $
100        polyfill, glam[t], gphi[t], color = color[i], _extra = ex $
101      ELSE plots, glam[t], gphi[t], color = color[i], _extra = ex
102      IF keyword_set(wait) THEN wait, wait
103      IF keyword_set(onebyone) THEN read, a, prompt = 'press a key'
104   ENDFOR
105   IF testvar(var = key_performance) EQ 2 THEN $
106    print, 'temps dessinetri: trace des triangles', systime(1)-tempdeux
107;
108   if keyword_set(key_performance) THEN print, 'temps dessinetri', systime(1)-tempsun
109
110   return
111end
Note: See TracBrowser for help on using the repository browser.