Subversion Repositories wimsdev

Rev

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

Rev 18350 Rev 18351
Line 718... Line 718...
718
    hypgeodaux(data,res);
718
    hypgeodaux(data,res);
719
    scale(res+5,qq,1);
719
    scale(res+5,qq,1);
720
    patchgdImageFill(image,qq[0],qq[1],pm->color[0]);
720
    patchgdImageFill(image,qq[0],qq[1],pm->color[0]);
721
  }
721
  }
722
}
722
}
723
/* hyperbolic geodesic through two points */
723
/* complete hyperbolic geodesic through two points */
724
void obj_hypline(objparm *pm)
-
 
725
{
-
 
726
  double rx,ry,res[7];
-
 
727
  if (hypgeodaux(pm->pd,res)){
-
 
728
      double alpha=atan(1/res[2]), beta = atan2(res[0], res[1]);
-
 
729
      scale(pm->pd, pm->p, 1);
-
 
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]);
-
 
732
  }
-
 
733
  else {
-
 
734
    double gamma = atan2(pm->pd[0],pm->pd[1]);
-
 
735
    res[0]=cos(gamma);
-
 
736
    res[1]=sin(gamma);
-
 
737
    res[2]=-cos(gamma);
-
 
738
    res[3]=-sin(gamma);
-
 
739
    scale(res,pm->p,2);
-
 
740
    gdImageLine(image,pm->p[0],pm->p[1],pm->p[2],pm->p[3],pm->color[0]);
-
 
741
  }
-
 
742
}
-
 
743
 
-
 
744
void obj_hyplines(objparm *pm)
724
void obj_hyplines(objparm *pm)
745
{
725
{
746
  double rx,ry,res[7];
726
  double rx,ry,res[7],*pd = pm->pd;
747
  int i;
727
  int i;
748
  for (i=0; i < pm->pcnt; i+=4)
728
  for (i=0; i < pm->pcnt; i+=4,pd+=4)
749
    if (hypgeodaux(pm->pd+i,res)) {
729
    if (hypgeodaux(pd,res)) {
750
      double alpha=atan(1/res[2]), beta = atan2(res[0],res[1]);
730
      double alpha=atan(1/res[2]), beta = atan2(res[1],res[0]);
751
      scale(pm->pd+i,pm->p,1);
731
      scale(res,pm->p,1);
752
      scale2(res[2],res[2],&rx,&ry);
732
      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]);
733
      myGdImageArc(image,pm->p[0],pm->p[1],rx,ry,180+(beta-alpha)/DEG,180+(beta+alpha)/DEG,pm->color[0]);
754
    }
734
    }
755
    else {
735
    else {
-
 
736
      double gamma;
-
 
737
      if (pd[1]*pd[1]+pd[0]*pd[0] > pd[2]*pd[2]+pd[3]*pd[3])
756
      double gamma = atan2(pm->pd[i],pm->pd[i+1]);
738
        gamma = atan2(pd[1],pd[0]);
-
 
739
      else
-
 
740
        gamma = atan2(pd[3],pd[2]);
757
      res[0]=cos(gamma);
741
      res[0]=cos(gamma);
758
      res[1]=sin(gamma);
742
      res[1]=sin(gamma);
759
      res[2]=-cos(gamma);
743
      res[2]=-cos(gamma);
760
      res[3]=-sin(gamma);
744
      res[3]=-sin(gamma);
761
      scale(res,pm->p,2);
745
      scale(res,pm->p,2);