Subversion Repositories wimsdev

Rev

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

Rev 18325 Rev 18326
Line 664... Line 664...
664
    res[6]=(q[1]+q[3])/2;
664
    res[6]=(q[1]+q[3])/2;
665
    return 0;}
665
    return 0;}
666
  cx = ny/dy; cy=-nx/dy;
666
  cx = ny/dy; cy=-nx/dy;
667
  a1 = atan2(q[1]-cy, q[0]-cx);
667
  a1 = atan2(q[1]-cy, q[0]-cx);
668
  a2 = atan2(q[3]-cy, q[2]-cx);
668
  a2 = atan2(q[3]-cy, q[2]-cx);
669
  a3 = (a1+a2)/2;
-
 
670
  if (fabs(a2-a1)>M_PI){if(a1<a2) a1+=2*M_PI; else a2+=2*M_PI;};
669
  if (fabs(a2-a1)>M_PI){if(a1<a2) a1+=2*M_PI; else a2+=2*M_PI;};
-
 
670
  a3 = (a1+a2)/2;
671
  if(a1>a2) {tmp=a1; a1=a2; a2=tmp;}
671
  if(a1>a2) {tmp=a1; a1=a2; a2=tmp;}
672
  r = sqrt(cx*cx+cy*cy-1);
672
  r = sqrt(cx*cx+cy*cy-1);
673
  res[0]=cx;
673
  res[0]=cx;
674
  res[1]=cy;
674
  res[1]=cy;
675
  res[2]=r;
675
  res[2]=r;
Line 725... Line 725...
725
{
725
{
726
  double rx,ry,res[7];
726
  double rx,ry,res[7];
727
  if (hypgeodaux(pm->pd,res)){
727
  if (hypgeodaux(pm->pd,res)){
728
      double alpha=atan(1/res[2]), beta = atan2(res[0], res[1]);
728
      double alpha=atan(1/res[2]), beta = atan2(res[0], res[1]);
729
      scale(pm->pd, pm->p, 1);
729
      scale(pm->pd, pm->p, 1);
730
      scale2(res[2],res[2],&rx,&ry);
730
      scale2(res[2],res[2],&rx,&ry);
731
      myGdImageArc(image, pm->p[0], pm->p[1], rx, ry, 180+(beta-alpha)/DEG, 180+(beta+alpha)/DEG,pm->color[0]);
731
      myGdImageArc(image, pm->p[0], pm->p[1], rx, ry, 180+(beta-alpha)/DEG, 180+(beta+alpha)/DEG,pm->color[0]);
732
  }
732
  }
733
  else {
733
  else {
734
    double gamma = atan2(pm->pd[0],pm->pd[1]);
734
    double gamma = atan2(pm->pd[0],pm->pd[1]);
735
    res[0]=cos(gamma);
735
    res[0]=cos(gamma);
Line 745... Line 745...
745
{
745
{
746
  double rx,ry,res[7];
746
  double rx,ry,res[7];
747
  int i;
747
  int i;
748
  for (i=0; i < pm->pcnt; i+=4)
748
  for (i=0; i < pm->pcnt; i+=4)
749
    if (hypgeodaux(pm->pd+i,res)) {
749
    if (hypgeodaux(pm->pd+i,res)) {
750
      double alpha=atan(1/res[2]), beta = atan2(res[0], res[1]);
750
      double alpha=atan(1/res[2]), beta = atan2(res[0],res[1]);
751
      scale(pm->pd+i, pm->p, 1);
751
      scale(pm->pd+i,pm->p,1);
752
      scale2(res[2],res[2],&rx,&ry);
752
      scale2(res[2],res[2],&rx,&ry);
753
      myGdImageArc(image, pm->p[0], pm->p[1], rx, ry, 180+(beta-alpha)/DEG, 180+(beta+alpha)/DEG,pm->color[0]);
753
      myGdImageArc(image,pm->p[0],pm->p[1],rx,ry,180+(beta-alpha)/DEG,180+(beta+alpha)/DEG,pm->color[0]);
754
    }
754
    }
755
    else {
755
    else {
756
      double gamma = atan2(pm->pd[i],pm->pd[i+1]);
756
      double gamma = atan2(pm->pd[i],pm->pd[i+1]);
757
      res[0]=cos(gamma);
757
      res[0]=cos(gamma);
758
      res[1]=sin(gamma);
758
      res[1]=sin(gamma);
Line 869... Line 869...
869
  dpts[2]=pm->pd[0]+pm->pd[2]*cos(DEG*pm->pd[3]);
869
  dpts[2]=pm->pd[0]+pm->pd[2]*cos(DEG*pm->pd[3]);
870
  dpts[3]=pm->pd[1]+pm->pd[2]*sin(DEG*pm->pd[3]);
870
  dpts[3]=pm->pd[1]+pm->pd[2]*sin(DEG*pm->pd[3]);
871
  dpts[4]=pm->pd[0]+pm->pd[2]*cos(DEG*pm->pd[4]);
871
  dpts[4]=pm->pd[0]+pm->pd[2]*cos(DEG*pm->pd[4]);
872
  dpts[5]=pm->pd[1]+pm->pd[2]*sin(DEG*pm->pd[4]);
872
  dpts[5]=pm->pd[1]+pm->pd[2]*sin(DEG*pm->pd[4]);
873
  scale(dpts, pts, 3);
873
  scale(dpts, pts, 3);
874
  gdImageLine(image,pts[0],pts[1],pts[2],pts[3],pm->color[0]);
874
    gdImageLine(image,pts[0],pts[1],pts[2],pts[3],pm->color[0]);
875
  gdImageLine(image,pts[0],pts[1],pts[4],pts[5],pm->color[0]);
875
    gdImageLine(image,pts[0],pts[1],pts[4],pts[5],pm->color[0]);
876
  gdImageArc(image,pts[0],pts[1],wx,wy,pm->pd[3],pm->pd[4],pm->color[0]);
876
  gdImageArc(image,pts[0],pts[1],wx,wy,pm->pd[3],pm->pd[4],pm->color[0]);
877
  if(tikz_file) {
877
  if(tikz_file) {
878
    fprintf(tikz_file, "\\draw\[%s, domain=%f:%f] plot ({%i+%f*cos(\\x)}, {%i+%f*sin(\\x)});\n",
878
    fprintf(tikz_file, "\\draw\[%s, domain=%f:%f] plot ({%i+%f*cos(\\x)}, {%i+%f*sin(\\x)});\n",
879
      tikz_options(pm->color[0],pm->fill),pm->pd[3],pm->pd[4],pts[0],wx*0.5,flip(pts[1]),wy*(-0.5));
879
      tikz_options(pm->color[0],pm->fill),pm->pd[3],pm->pd[4],pts[0],wx*0.5,flip(pts[1]),wy*(-0.5));
880
    fprintf(tikz_file, "\\draw\[%s] (%i, %i) -- (%i, %i) (%i, %i) -- (%i, %i);\n",
880
    fprintf(tikz_file, "\\draw\[%s] (%i, %i) -- (%i, %i) (%i, %i) -- (%i, %i);\n",