Subversion Repositories wimsdev

Rev

Rev 18638 | Rev 18641 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 18638 Rev 18639
Line 5668... Line 5668...
5668
          break;
5668
          break;
5669
        case HYPSEGMENTS:
5669
        case HYPSEGMENTS:
5670
  /*
5670
  /*
5671
  @ hypsegments color,x1,y1,x2,y2,...,x_n,y_n
5671
  @ hypsegments color,x1,y1,x2,y2,...,x_n,y_n
5672
  @ draw multiple hyperbolic segments in the Poincaré disk between points (x1:y1)--(x2:y2).....and... (x_n-1:y_n-1)--(x_n:y_n) in color ''color``
5672
  @ draw multiple hyperbolic segments in the Poincaré disk between points (x1:y1)--(x2:y2).....and... (x_n-1:y_n-1)--(x_n:y_n) in color ''color``
5673
  @ use command ''linewidth int`` to adjust size
-
 
5674
  may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a> individually (!)
5673
  @ use command ''linewidth int`` to adjust size may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a> individually (!)
5675
  @%hypsegments%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%linewidth 2%hypsegments green,0.1,-0.3,0.6,0.7,0.3,0,-0.8,0.6,0.6,0.5,-0.5,0.6
5674
  @%hypsegments%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%linewidth 2%hypsegments green,0.1,-0.3,0.6,0.7,0.3,0,-0.8,0.6,0.6,0.5,-0.5,0.6
-
 
5675
  */
-
 
5676
  /*
5676
  segments_onclick%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%onclick%segments green,1,1,3,3,0,0,-3,3,1,1,4,-1,-5,5,-3,-1
5677
  segments_onclick%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%onclick%segments green,1,1,3,3,0,0,-3,3,1,1,4,-1,-5,5,-3,-1
5677
  segments_drag_y%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%drag y%segments green,1,1,3,3,0,0,-3,3,1,1,4,-1,-5,5,-3,-1
5678
  segments_drag_y%size 400,400%xrange -10,10%yrange -10,10%linewidth 2%drag y%segments green,1,1,3,3,0,0,-3,3,1,1,4,-1,-5,5,-3,-1
5678
  */
5679
  */
5679
          stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/
5680
          stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/
5680
          fill_color = stroke_color;
5681
          fill_color = stroke_color;
Line 5682... Line 5683...
5682
          while( ! done ){     /* get next item until EOL*/
5683
          while( ! done ){     /* get next item until EOL*/
5683
            if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");}
5684
            if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");}
5684
              if(i%2 == 0 ){
5685
              if(i%2 == 0 ){
5685
                double_data[i] = get_real(infile,0); /* x */
5686
                double_data[i] = get_real(infile,0); /* x */
5686
              }
5687
              }
5687
            else {
5688
            else {
5688
              double_data[i] = get_real(infile,1); /* y */
5689
              double_data[i] = get_real(infile,1); /* y */
5689
            }
5690
            }
5690
            i++;
5691
            i++;
5691
          }
5692
          }
5692
          if(use_rotate == TRUE ){rotate(i-1,angle,rotationcenter,2);}
5693
          if(use_rotate == TRUE ){rotate(i-1,angle,rotationcenter,2);}
5693
          if(use_affine == TRUE ){ transform(i-1,2);}
5694
          if(use_affine == TRUE ){ transform(i-1,2);}
5694
          if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */
5695
          if( use_slider != -1 && onclick == 0){ onclick = 3; }/* no drag&onclick but slideable */
5695
          decimals = find_number_of_digits(precision);
5696
          decimals = find_number_of_digits(precision);
5696
          for(c = 0 ; c < i-1 ; c = c+4){
5697
          for(c = 0 ; c < i-1 ; c = c+4){
5697
            tmp_buffer=my_newmem(MAX_BUFFER);
5698
            tmp_buffer=my_newmem(MAX_BUFFER);
5698
            if (hypgeodaux(double_data+c,res,0)){
5699
            if (hypgeodaux(double_data+c,res,0)){
5699
              check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,12,[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,res[0],decimals,res[0],decimals,res[1],decimals,res[1],decimals,res[2],decimals,res[3],decimals,res[4],decimals,res[5],line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset));
5700
              check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,12,[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,res[0],decimals,res[0],decimals,res[1],decimals,res[1],decimals,res[2],decimals,res[3],decimals,res[4],decimals,res[5],line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset));
5700
            }
5701
            }
5701
            else {
5702
            else {
5702
              check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,4,[%.*f,%.*f],[%.*f,%.*f],[30,30],[30,30],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[c],decimals,double_data[c+2],decimals,double_data[c+1],decimals,double_data[c+3],line_width,stroke_color,stroke_opacity,stroke_color,stroke_opacity,0,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset));
5703
              check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,4,[%.*f,%.*f],[%.*f,%.*f],[30,30],[30,30],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,double_data[c],decimals,double_data[c+2],decimals,double_data[c+1],decimals,double_data[c+3],line_width,stroke_color,stroke_opacity,stroke_color,stroke_opacity,0,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset));
5703
            }
5704
            }
5704
            add_to_buffer(tmp_buffer);
5705
            add_to_buffer(tmp_buffer);
5705
            if(onclick != 0){object_cnt++;}
5706
            if(onclick != 0){object_cnt++;}
Line 5707... Line 5708...
5707
          reset();
5708
          reset();
5708
          dragstuff[4] = 1;dragstuff[12] = 1;
5709
          dragstuff[4] = 1;dragstuff[12] = 1;
5709
          if(use_dragstuff == 0 ){ use_dragstuff = 1; }
5710
          if(use_dragstuff == 0 ){ use_dragstuff = 1; }
5710
          break;
5711
          break;
5711
        case HYPLINES:
5712
        case HYPLINES:
5712
        /*
5713
  /*
5713
  @ hyplines color,x1,y1,x2,y2...x_n-1,y_n-1,x_n,y_n
5714
  @ hyplines color,x1,y1,x2,y2...x_n-1,y_n-1,x_n,y_n
5714
  @ draw multiple hyperbolic lines in the Poincaré disk through points (x1:y1)--(x2:y2) ...(x_n-1:y_n-1)--(x_n:y_n) in color 'color'
5715
  @ draw multiple hyperbolic lines in the Poincaré disk through points (x1:y1)--(x2:y2) ...(x_n-1:y_n-1)--(x_n:y_n) in color 'color' may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
5715
  may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
-
 
5716
  @%hyplines%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%hyplines green,0,0.1,0.1,0.3,0.2,0.3,0.1,0.3,0,0.5,-0.5,0.4
5716
  @%hyplines%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%hyplines green,0,0.1,0.1,0.3,0.2,0.3,0.1,0.3,0,0.5,-0.5,0.4
5717
  */
5717
  */
5718
          stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/
5718
          stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/
5719
          fill_color = stroke_color;
5719
          fill_color = stroke_color;
5720
          i=0;
5720
          i=0;
5721
          while( ! done ){     /* get next item until EOL*/
5721
          while( ! done ){     /* get next item until EOL*/
5722
            if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");}
5722
            if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");}
5723
            if(i%2 == 0 ){
5723
            if(i%2 == 0 ){
5724
              double_data[i] = get_real(infile,0); /* x */
5724
              double_data[i] = get_real(infile,0); /* x */
5725
            }
5725
            }
5726
            else {
5726
            else {
5727
              double_data[i] = get_real(infile,1); /* y */
5727
              double_data[i] = get_real(infile,1); /* y */
5728
            }
5728
            }
5729
            i++;
5729
            i++;
5730
          }
5730
          }
5731
          if(use_rotate == TRUE ){rotate(i-1,angle,rotationcenter,2);}
5731
          if(use_rotate == TRUE ){rotate(i-1,angle,rotationcenter,2);}
Line 5737... Line 5737...
5737
            tmp_buffer=my_newmem(MAX_BUFFER);
5737
            tmp_buffer=my_newmem(MAX_BUFFER);
5738
            if (hypgeodaux(double_data+c,res,1)){
5738
            if (hypgeodaux(double_data+c,res,1)){
5739
              check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,12,[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,res[0],decimals,res[0],decimals,res[1],decimals,res[1],decimals,res[2],decimals,res[3],decimals,res[4],decimals,res[5],line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset));}
5739
              check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,12,[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],[%.*f,%.*f],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,res[0],decimals,res[0],decimals,res[1],decimals,res[1],decimals,res[2],decimals,res[3],decimals,res[4],decimals,res[5],line_width,stroke_color,stroke_opacity,fill_color,fill_opacity,use_filled,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset));}
5740
            else {
5740
            else {
5741
              check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,4,[%.*f,%.*f],[%.*f,%.*f],[30,30],[30,30],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,res[0],decimals,res[2],decimals,res[1],decimals,res[3],line_width,stroke_color,stroke_opacity,fill_color,stroke_opacity,0,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset));
5741
              check_string_length(snprintf(tmp_buffer,MAX_BUFFER,"dragstuff.addShape(new Shape(%d,%d,%d,%d,4,[%.*f,%.*f],[%.*f,%.*f],[30,30],[30,30],%d,\"%s\",%.2f,\"%s\",%.2f,%d,%d,%d,%d,%d,%.1f,\"%s\",%d,\"%s\",%s,%s,%d));\n",drag_type,object_cnt,onclick,use_snap,decimals,res[0],decimals,res[2],decimals,res[1],decimals,res[3],line_width,stroke_color,stroke_opacity,fill_color,stroke_opacity,0,use_dashed,dashtype[0],dashtype[1],use_rotate,angle,flytext,font_size,font_family,my_sliders,rotation_center,use_offset));
5742
            }
5742
            }
5743
            add_to_buffer(tmp_buffer);
5743
            add_to_buffer(tmp_buffer);
5744
            if(onclick != 0){object_cnt++;}
5744
            if(onclick != 0){object_cnt++;}
5745
          }
5745
          }
5746
          reset();
5746
          reset();
5747
          dragstuff[4] = 1;dragstuff[12] = 1;
5747
          dragstuff[4] = 1;dragstuff[12] = 1;
5748
          if(use_dragstuff == 0 ){ use_dragstuff = 1; }
5748
          if(use_dragstuff == 0 ){ use_dragstuff = 1; }
5749
          break;
5749
          break;
5750
        case HYPPOLY:
5750
        case HYPPOLY:
-
 
5751
    /*
5751
/*  @ hyppolygon color,x1,y1,x2,y2...x_n-1,y_n-1,x_n,y_n
5752
    @ hyppolygon color,x1,y1,x2,y2...x_n-1,y_n-1,x_n,y_n
5752
    @ draw hyperbolicpolygon in the Poincaré disk through points (x1:y1)--(x2:y2) ...(x_n-1:y_n-1)--(x_n:y_n) -- (x1:y1)  in color 'color'
5753
    @ draw hyperbolicpolygon in the Poincaré disk through points (x1:y1)--(x2:y2) ...(x_n-1:y_n-1)--(x_n:y_n) -- (x1:y1)  in color 'color' may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
5753
    may be set <a href="#drag">draggable</a> / <a href="#onclick">onclick</a>
-
 
5754
    @ option fhyppolygon only for convex polygon for the moment
5754
    @ option fhyppolygon only for convex polygon for the moment
5755
    @%hyppolygon%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%hyppolygon green,0,0,0.5,0.3,0.8,-0.1,0.4,-0.5
5755
    @%hyppolygon%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%hyppolygon green,0,0,0.5,0.3,0.8,-0.1,0.4,-0.5
5756
*/
5756
    */
5757
          stroke_color=get_color(infile,0);
5757
          stroke_color=get_color(infile,0);
5758
          fill_color = stroke_color;
5758
          fill_color = stroke_color;
5759
          i=0;
5759
          i=0;
5760
          while( ! done ){     /* get next item until EOL*/
5760
          while( ! done ){     /* get next item until EOL*/
5761
            if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");}
5761
            if(i > MAX_INT - 1){canvas_error("too many points in argument: repeat command multiple times to fit");}
5762
            if(i%2 == 0 ){
5762
            if(i%2 == 0 ){
5763
              double_data[i] = get_real(infile,0); /* x */
5763
              double_data[i] = get_real(infile,0); /* x */
5764
            }
5764
            }
5765
            else {
5765
            else {
5766
              double_data[i] = get_real(infile,1); /* y */
5766
              double_data[i] = get_real(infile,1); /* y */
5767
            }
5767
            }
5768
            i++;
5768
            i++;
5769
          }
5769
          }
5770
          /* il faut rajouter le premier point à la fin*/
5770
          /* il faut rajouter le premier point à la fin*/
5771
          double_data[i]=double_data[0]; double_data[i+1]=double_data[1];
5771
          double_data[i]=double_data[0]; double_data[i+1]=double_data[1];
5772
          if(use_rotate == TRUE ){rotate(i-1,angle,rotationcenter,2);}
5772
          if(use_rotate == TRUE ){rotate(i-1,angle,rotationcenter,2);}
Line 5798... Line 5798...
5798
          reset();
5798
          reset();
5799
          break;
5799
          break;
5800
        case HYPRAYS:
5800
        case HYPRAYS:
5801
  /*
5801
  /*
5802
  @ hyprays color,xc,yc,x1,y1,x2,y2,x3,y3...x_n,y_n
5802
  @ hyprays color,xc,yc,x1,y1,x2,y2,x3,y3...x_n,y_n
5803
  @ draw hyperbolic rays in the Poincaré disk in color 'color' and center (xc:yc)
5803
  @ draw hyperbolic rays in the Poincaré disk in color 'color' and center (xc:yc) may be set draggable or onclick (every individual ray)
5804
   may be set draggable or onclick (every individual ray)
-
 
5805
  @%hyprays%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%onclick%hyprays blue,0.5,0.5,0.3,0.9,-0.3,0.5,-0.4,0,0.4,-0.9,-0.8,0.1,-0.1,-0.9
5804
  @%hyprays%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%onclick%hyprays blue,0.5,0.5,0.3,0.9,-0.3,0.5,-0.4,0,0.4,-0.9,-0.8,0.1,-0.1,-0.9
-
 
5805
  */
-
 
5806
  /*
5806
   hyprays_onclick%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%onclick%hyprays blue,0.5,0.5,0.3,0.9,-0.3,0.5,-0.4,0,0.4,-0.9,-0.8,0.1,-0.1,-0.9
5807
   hyprays_onclick%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%onclick%hyprays blue,0.5,0.5,0.3,0.9,-0.3,0.5,-0.4,0,0.4,-0.9,-0.8,0.1,-0.1,-0.9
5807
   hyprays_drag_xy%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%drag xy%hyprays blue,0,0,0.3,0.9,-0.3,0.5,-0.4,0,0.4,-0.9,-0.8,0.1,-0.1,-0.9
5808
   hyprays_drag_xy%size 400,400%xrange -1,1%yrange -1,1%circles black,0,0,1%drag xy%hyprays blue,0,0,0.3,0.9,-0.3,0.5,-0.4,0,0.4,-0.9,-0.8,0.1,-0.1,-0.9
5808
  */
5809
  */
5809
          stroke_color=get_color(infile,0);
5810
          stroke_color=get_color(infile,0);
5810
          if(fillcolor) {fill_color=fillcolor;} else {fill_color=stroke_color;}
5811
          if(fillcolor) {fill_color=fillcolor;} else {fill_color=stroke_color;}
Line 5850... Line 5851...
5850
  @ draw hyperbolic circles in Poincaré disk
5851
  @ draw hyperbolic circles in Poincaré disk
5851
  @ <b>attention</b> r = radius in x-range (!)
5852
  @ <b>attention</b> r = radius in x-range (!)
5852
  @ use keyword <code>filled</code> or command <code>fhypcircles</code> to produce solid circles
5853
  @ use keyword <code>filled</code> or command <code>fhypcircles</code> to produce solid circles
5853
  @ use command <code>fillcolor color</code> to set the fillcolor
5854
  @ use command <code>fillcolor color</code> to set the fillcolor
5854
  @%hypcircles%size 400,400%xrange -1,1%yrange -1,1%filled%fillcolor lightblue%opacity 255,50%hypcircles blue,0,0,1,0.4,0.4,3,0.2,0.6,6
5855
  @%hypcircles%size 400,400%xrange -1,1%yrange -1,1%filled%fillcolor lightblue%opacity 255,50%hypcircles blue,0,0,1,0.4,0.4,3,0.2,0.6,6
-
 
5856
  */
-
 
5857
  /*
5855
  hypcircles_drag%size 400,400%xrange -1,1%yrange -1,1%filled%fillcolor lightblue%opacity 255,50%drag xy%hypcircles blue,0,0,2,0.2,0.2,3,0.2,0.2,5%zoom red
5858
  hypcircles_drag%size 400,400%xrange -1,1%yrange -1,1%filled%fillcolor lightblue%opacity 255,50%drag xy%hypcircles blue,0,0,2,0.2,0.2,3,0.2,0.2,5%zoom red
5856
  hypcircles_onclick%size 400,400%xrange -1,1%yrange -1,1%filled%fillcolor lightblue%opacity 255,50%onclick%hypcircles blue,0,0,2,0.2,0.2,3,0.2,0.2,5%zoom red
5859
  hypcircles_onclick%size 400,400%xrange -1,1%yrange -1,1%filled%fillcolor lightblue%opacity 255,50%onclick%hypcircles blue,0,0,2,0.2,0.2,3,0.2,0.2,5%zoom red
5857
  hypcircles_drag_slider%size 400,400%xrange -1,1%yrange -1,1%linewidth 2%drag xy%# Click circles(s) to activate%opacity 200,50%fillcolor orange%rotationcenter 2,3%slider 0,2*pi,300,30,angle degrees,Rotate%slider -5,5*pi,300,30,x display,move in x-direction%slider -10,10*pi,300,30,y display,move in y-direction%hypcircles blue,0,0,2,0.2,0.2,3,0.2,0.2,5
5860
  hypcircles_drag_slider%size 400,400%xrange -1,1%yrange -1,1%linewidth 2%drag xy%# Click circles(s) to activate%opacity 200,50%fillcolor orange%rotationcenter 2,3%slider 0,2*pi,300,30,angle degrees,Rotate%slider -5,5*pi,300,30,x display,move in x-direction%slider -10,10*pi,300,30,y display,move in y-direction%hypcircles blue,0,0,2,0.2,0.2,3,0.2,0.2,5
5858
  */
5861
  */
5859
          stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/
5862
          stroke_color=get_color(infile,0); /* how nice: now the color comes first...*/