Rev 18447 | Rev 18492 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 18447 | Rev 18455 | ||
---|---|---|---|
Line 714... | Line 714... | ||
714 | void myGdImageArc(gdImagePtr im, double cx, double cy, double rx, double ry, double t1, double t2, int color) |
714 | void myGdImageArc(gdImagePtr im, double cx, double cy, double rx, double ry, double t1, double t2, int color) |
715 | { |
715 | { |
716 | int i,nb; |
716 | int i,nb; |
717 | double dt, r=rx>ry?rx:ry; |
717 | double dt, r=rx>ry?rx:ry; |
718 | t2-=t1; |
718 | t2-=t1; |
- | 719 | if(t2==0) return; |
|
719 | t2-=360*floor(t2/360); |
720 | t2-=360*floor(t2/360); |
720 | if(t2==0) t2=360; |
721 | if(t2==0) t2=360; |
721 | t1*=DEG;t2*=DEG; |
722 | t1*=DEG;t2*=DEG; |
722 | nb = r*t2/3; |
723 | nb = r*t2/3; |
723 | dt = t2/nb; |
724 | dt = t2/nb; |
Line 731... | Line 732... | ||
731 | scale(pm->pd,pm->p,1); |
732 | scale(pm->pd,pm->p,1); |
732 | int rx=pm->pd[2]*xscale/2, ry=pm->pd[3]*yscale/2; |
733 | int rx=pm->pd[2]*xscale/2, ry=pm->pd[3]*yscale/2; |
733 | myGdImageArc(image, pm->p[0], pm->p[1], rx, ry, pm->pd[4],pm->pd[5],pm->color[0]); |
734 | myGdImageArc(image, pm->p[0], pm->p[1], rx, ry, pm->pd[4],pm->pd[5],pm->color[0]); |
734 | if(tikz_file){ |
735 | if(tikz_file){ |
735 | pm->pd[5]-=pm->pd[4]; |
736 | pm->pd[5]-=pm->pd[4]; |
- | 737 | if (pm->pd[5]==0) return; |
|
736 | pm->pd[5]-=360*floor(pm->pd[5]/360); |
738 | pm->pd[5]-=360*floor(pm->pd[5]/360); |
- | 739 | if (pm->pd[5]==0) pm->pd[5]=360; |
|
737 | pm->pd[5]+=pm->pd[4]; |
740 | pm->pd[5]+=pm->pd[4]; |
738 | fprintf(tikz_file, |
741 | fprintf(tikz_file, |
739 | "\\draw \[%s] (%i,%i) arc (%f:%f:%i and %i);\n", |
742 | "\\draw \[%s] (%i,%i) arc (%f:%f:%i and %i);\n", |
740 | tikz_options(pm->color[0],pm->fill), |
743 | tikz_options(pm->color[0],pm->fill), |
741 | (int)rint(pm->p[0]+rx*cos(DEG*pm->pd[4])), |
744 | (int)rint(pm->p[0]+rx*cos(DEG*pm->pd[4])), |
Line 2019... | Line 2022... | ||
2019 | scale2(res[2],res[2],&rx,&ry); |
2022 | scale2(res[2],res[2],&rx,&ry); |
2020 | myGdImageArc(image,pm->p[0],pm->p[1],rx,ry,180+(beta-alpha)/DEG,180+(beta+alpha)/DEG,pm->color[0]); |
2023 | myGdImageArc(image,pm->p[0],pm->p[1],rx,ry,180+(beta-alpha)/DEG,180+(beta+alpha)/DEG,pm->color[0]); |
2021 | if (tikz_file) fprintf(tikz_file, "(%i,%i) arc (%f:%f:%i and %i);\n", |
2024 | if (tikz_file) fprintf(tikz_file, "(%i,%i) arc (%f:%f:%i and %i);\n", |
2022 | (int)rint(pm->p[0]-rx*cos(beta-alpha)), flip((int)rint(pm->p[1]-ry*sin(beta-alpha))), |
2025 | (int)rint(pm->p[0]-rx*cos(beta-alpha)), flip((int)rint(pm->p[1]-ry*sin(beta-alpha))), |
2023 | 180+(beta-alpha)/DEG,180+(beta+alpha)/DEG, (int)rint(rx),-(int)rint(ry)); |
2026 | 180+(beta-alpha)/DEG,180+(beta+alpha)/DEG, (int)rint(rx),-(int)rint(ry)); |
2024 | } |
2027 | } |
2025 | else { |
2028 | else { |
2026 | double gamma; |
2029 | double gamma; |
2027 | if (pd[1]*pd[1]+pd[0]*pd[0] > pd[2]*pd[2]+pd[3]*pd[3]) |
2030 | if (pd[1]*pd[1]+pd[0]*pd[0] > pd[2]*pd[2]+pd[3]*pd[3]) |
2028 | gamma = atan2(pd[1],pd[0]); |
2031 | gamma = atan2(pd[1],pd[0]); |
2029 | else |
2032 | else |