Subversion Repositories wimsdev

Rev

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