Changeset b14053 in git for Singular/LIB/tropical.lib


Ignore:
Timestamp:
Jul 9, 2009, 2:20:30 PM (15 years ago)
Author:
Thomas Markwig <keilen@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
c6971ddc4d46c0a2cec7912a6de31e2a748146da
Parents:
0a78c3b07600e6691a158387d392658721cf6619
Message:
In der Prozedur texDrawTropical habe ich die Skalierung geaendert, so dass im Fall eines Skalierungsfaktors <1/100 die Koordinaten selbst skaliert werden. texdraw hat Probleme mit zu grossen Koordinaten


git-svn-id: file:///usr/local/Singular/svn/trunk@11969 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/LIB/tropical.lib

    r0a78c3 rb14053  
    1 version="$Id: tropical.lib,v 1.17 2009-05-13 14:51:55 keilen Exp $";
     1version="$Id: tropical.lib,v 1.18 2009-07-09 12:20:30 keilen Exp $";
    22category="Tropical Geometry";
    33info="
     
    26602660    maxdiffy=1;
    26612661  }
     2662  int nachkomma=2; // number of decimals for the scalefactor
     2663  number sf=1; // correction factor for scalefactor
    26622664  if (size(#)!=2)
    26632665  {
    26642666    poly scalefactor=minOfPolys(list(12/leadcoef(maxdiffx),16/leadcoef(maxdiffy)));
     2667    // if the scalefactor is less than 1/100, then we need more than 2 decimals
     2668    if (leadcoef(scalefactor) < 1/100)
     2669    {
     2670      number scf=leadcoef(scalefactor);
     2671      while (scf < 1/100)
     2672      {
     2673        scf=scf * 10;
     2674        nachkomma++;
     2675      }
     2676    }   
     2677    // if the scalefactor is < 1/100, then we should rather scale the
     2678    // coordinates directly, since otherwise texdraw gets into trouble
     2679    if (nachkomma > 2)
     2680    {
     2681      for (i=3;i<=nachkomma;i++)
     2682      {
     2683        scalefactor=scalefactor * 10;
     2684        sf=sf*10;
     2685      }
     2686    }   
    26652687    texdrawtp=texdrawtp+"
    2666        \\relunitscale "+ decimal(scalefactor);
     2688       \\relunitscale "+ decimal(scalefactor,nachkomma);
    26672689  }
    26682690  else
     
    26782700    {
    26792701      texdrawtp=texdrawtp+"
    2680        \\move ("+decimal(graph[i][1]-centerx)+" "+decimal(graph[i][2]-centery)+") \\fcir f:0 r:"+decimal(2/(leadcoef(scalefactor)*10),size(string(int(scalefactor)))+1);
     2702       \\move ("+decimal((graph[i][1]-centerx)/sf)+" "+decimal((graph[i][2]-centery)/sf)+") \\fcir f:0 r:"+decimal(2/(leadcoef(scalefactor)*10),size(string(int(scalefactor)))+1);
    26812703    }
    26822704    // draw the bounded edges emerging from the ith vertex
     
    26882710      {                       
    26892711        texdrawtp=texdrawtp+"
    2690        \\move ("+decimal(graph[i][1]-centerx)+" "+decimal(graph[i][2]-centery)+") \\lvec ("+decimal(graph[graph[i][3][1,j]][1]-centerx)+" "+decimal(graph[graph[i][3][1,j]][2]-centery)+")";
     2712       \\move ("+decimal((graph[i][1]-centerx)/sf)+" "+decimal((graph[i][2]-centery)/sf)+") \\lvec ("+decimal((graph[graph[i][3][1,j]][1]-centerx)/sf)+" "+decimal((graph[graph[i][3][1,j]][2]-centery)/sf)+")";
    26912713        // if the multiplicity is more than one, denote it in the picture
    26922714        if (graph[i][3][2,j]>1)
    26932715        {
    26942716          texdrawtp=texdrawtp+"
    2695        \\htext ("+decimal((graph[i][1]-centerx+graph[graph[i][3][1,j]][1])/2)+" "+decimal((graph[i][2]-centery+graph[graph[i][3][1,j]][2])/2)+"){$"+string(graph[i][3][2,j])+"$}";
     2717       \\htext ("+decimal((graph[i][1]-centerx+graph[graph[i][3][1,j]][1])/(2*sf))+" "+decimal((graph[i][2]-centery+graph[graph[i][3][1,j]][2])/(2*sf))+"){$"+string(graph[i][3][2,j])+"$}";
    26962718        }
    26972719      }
     
    27012723    for (j=1;j<=size(graph[i][4]);j++)
    27022724    {     
    2703       relxy=shorten(list(decimal(3*graph[i][4][j][1][1]/scalefactor),decimal(3*graph[i][4][j][1][2]/scalefactor),"2.5"));
     2725      relxy=shorten(list(decimal((3*graph[i][4][j][1][1]/scalefactor)*sf),decimal((3*graph[i][4][j][1][2]/scalefactor)*sf),string(5*sf/2)));
    27042726      texdrawtp=texdrawtp+"
    2705        \\move ("+decimal(graph[i][1]-centerx)+" "+decimal(graph[i][2]-centery)+") \\rlvec ("+relxy[1]+" "+relxy[2]+")";
     2727       \\move ("+decimal((graph[i][1]-centerx)/sf)+" "+decimal((graph[i][2]-centery)/sf)+") \\rlvec ("+relxy[1]+" "+relxy[2]+")";
    27062728      // if the multiplicity is more than one, denote it in the picture
    27072729      if (graph[i][4][j][2]>1)
    27082730      {
    27092731        texdrawtp=texdrawtp+"
    2710        \\htext ("+decimal(graph[i][1]-centerx+graph[i][4][j][1][1]/scalefactor)+" "+decimal(graph[i][2]-centery+graph[i][4][j][1][2]/scalefactor)+"){$"+string(graph[i][4][j][2])+"$}";
     2732       \\htext ("+decimal(graph[i][1]/sf-centerx/sf+graph[i][4][j][1][1]/scalefactor)+" "+decimal(graph[i][2]/sf-centery/sf+graph[i][4][j][1][2]/scalefactor)+"){$"+string(graph[i][4][j][2])+"$}";
    27112733      }
    27122734    }
Note: See TracChangeset for help on using the changeset viewer.