Subversion Repositories wimsdev

Rev

Rev 17173 | Rev 17963 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
20 reyssat 1
!if  $wims_read_parm!=slib_header
13587 bpr 2
  !goto proc
20 reyssat 3
!endif
4158 bpr 4
 
4351 bpr 5
slib_author=Bernadette, Perrin-Riou
4158 bpr 6
 
17954 bpr 7
slib_example= [0,0,0;0,0,1;0,1,0],[blue,red], [A,B,C],2\
8
 [0,0,0;0,0,1;0,1,0],[blue,red], [A,B,C],2,html\
9
 [0,0,0;0,0,1;0,1,0],[blue,red], [A,B,C],1,2,html
3265 bpr 10
slib_require=pari
20 reyssat 11
!exit
12
 
13
:proc
14
 
15
!reset slib_color, slib_names, slib_point
16
 
17
slib_parm=!item 1 to 3 of $wims_read_parm
18
!distribute item $slib_parm into slib_H, slib_color,slib_names
19
slib_point=!item 4 to -1 of $wims_read_parm
4172 bpr 20
!if $(slib_point[-1]) iswordof url html raw
21
  slib_option=$(slib_point[-1])
22
  slib_point=$(slib_point[1..-2])
7692 bpr 23
!endif
20 reyssat 24
slib_H=!declosing $slib_H
8560 bpr 25
slib_H=!translate internal  ;  to $\
26
$ in $slib_H
27
slib_HH=!translate internal $\
28
$ to ; in $slib_H
20 reyssat 29
 
30
slib_point=!declosing $slib_point
31
slib_color=!declosing $slib_color
32
!default slib_color=blue,red,green, magenta, brown, purple,gold
8560 bpr 33
!distribute items $slib_color into slib_color1, slib_color2, slib_color3, slib_color4, slib_color5, slib_color6,slib_color7
17954 bpr 34
!for slib_i in $slib_point
35
  !reset slib_segments$slib_i
36
!next
7692 bpr 37
slib_or=!exec pari Mat([$slib_HH])==Mat([$slib_HH])~
20 reyssat 38
slib_names=!declosing $slib_names
39
slib_n=!line 1 of $slib_H
40
slib_n=!itemcnt $slib_n
8560 bpr 41
!default slib_names=!values slib_i for slib_i=1 to $slib_n
20 reyssat 42
slib_vertex= !values x for x=1 to $slib_n
43
!default slib_point= $slib_vertex
7692 bpr 44
slib_liste =
20 reyssat 45
slib_cnt = 0
46
slib_matrix=
47
slib_out=
8560 bpr 48
!for slib_i in $slib_point
12676 bpr 49
  !if $slib_i notin $slib_liste
50
    !read slib/graph/connexcomponent [$slib_HH], $slib_i
51
    slib_liste = !append item $slib_out to $slib_liste
52
    slib_matrix = !append line $slib_out to $slib_matrix
53
    !advance slib_cnt
54
    slib_out=
55
  !endif
20 reyssat 56
!next slib_i
57
slib_point2 = !listcomplement of $slib_liste in $slib_vertex
58
 
8560 bpr 59
!for slib_i in $slib_point2
12676 bpr 60
  !if $slib_i notin $slib_liste
61
    !read slib/graph/connexcomponent [$slib_HH], $slib_i
62
    slib_liste = !append item $slib_out to $slib_liste
63
    slib_matrix = !append line $slib_out to $slib_matrix
64
    !advance slib_cnt
65
  !endif
20 reyssat 66
!next slib_i
67
 
68
slib_dessin = xrange -1.5,1.5\
69
yrange -1.5,1.5
70
!for slib_i=1 to $slib_cnt
12676 bpr 71
  slib_color$slib_i= !declosing $(slib_color$slib_i)
72
  slib_h=!line $slib_i of $slib_matrix
73
  !for slib_k in $slib_h
74
    slib_name =!item $slib_k of $slib_names
75
    slib_dessin=$slib_dessin\
17954 bpr 76
disk cos(2*pi*$slib_k/$slib_n ),sin(2*pi*$slib_k/$slib_n ), 6,$(slib_color$slib_i)\
77
text black, 1.3*cos(2*pi*$slib_k/$slib_n ),1.3*sin(2*pi*$slib_k/$slib_n ), medium ,$slib_name
8321 bpr 78
    slib_r=!line $slib_k of $slib_H
12676 bpr 79
    !if $slib_or=1
80
      !for slib_j   in $slib_h
81
        slib_u=!item $slib_j of $slib_r
82
        !if $slib_u=1
83
          !if $slib_k<>$slib_j
17954 bpr 84
            slib_segments$slib_i=!append item cos(2*pi*$slib_k/$slib_n),sin(2*pi*$slib_k/$slib_n), cos(2*pi*$slib_j/$slib_n ),sin(2*pi*$slib_j/$slib_n) to $(slib_segments$slib_i)
12676 bpr 85
          !else
86
            slib_dessin=$slib_dessin\
20 reyssat 87
ellipse cos(2*pi*$slib_i/$slib_n )*1.25,sin(2*pi*$slib_i/$slib_n )*1.25, 0.5,0.5,$(slib_color$slib_i)
12676 bpr 88
          !endif
89
        !endif
90
      !next slib_j
91
    !else
92
      !for slib_j=1 to $slib_n
93
        slib_r=!line $slib_k of $slib_H
94
        slib_u=!item $slib_j of $slib_r
95
        !if $slib_u=1
96
          !if $slib_k<>$slib_j
97
            slib_dessin=$slib_dessin\
17954 bpr 98
arrow $[cos(2*pi*$slib_k/$slib_n )],$[sin(2*pi*$slib_k/$slib_n)], $[(cos(2*pi*$slib_k/$slib_n )-cos(2*pi*$slib_j/$slib_n ))/2+cos(2*pi*$slib_j/$slib_n )],$[(sin(2*pi*$slib_k/$slib_n )-sin(2*pi*$slib_j/$slib_n ))/2+sin(2*pi*$slib_j/$slib_n )],10,$(slib_color$slib_i)
99
            slib_segments$slib_i=!append item cos(2*pi*$slib_k/$slib_n ),sin(2*pi*$slib_k/$slib_n ),cos(2*pi*$slib_j/$slib_n ),sin(2*pi*$slib_j/$slib_n ) to $(slib_segments$slib_i)
12676 bpr 100
          !else
101
            slib_dessin=$slib_dessin\
20 reyssat 102
ellipse cos(2*pi*$slib_k/$slib_n )*1.25,sin(2*pi*$slib_k/$slib_n )*1.25, 0.5,0.5,$(slib_color$slib_i)
12676 bpr 103
          !endif
8321 bpr 104
        !endif
12676 bpr 105
      !next slib_j
106
    !endif
107
  !next slib_k
17954 bpr 108
  !if $(slib_segments$slib_i)!=
109
    slib_dessin=$slib_dessin\
110
segments $(slib_color$slib_i), $(slib_segments$slib_i)
111
  !endif
7692 bpr 112
!next slib_i
20 reyssat 113
 
17954 bpr 114
slib_out=$slib_dessin
4172 bpr 115
 
116
!if url iswordof $slib_option or html iswordof $slib_option
117
  insdraw_size=250,250
118
  !insdraw $slib_out
119
  slib_out=$ins_url
12676 bpr 120
  !if html iswordof $slib_option
17173 bpr 121
    slib_out=<img src="$ins_url" alt="">
12676 bpr 122
  !else
4908 bpr 123
    slib_out=$slib_out,$insdraw_size
12676 bpr 124
  !endif
4172 bpr 125
!endif