Rev 18518 | Rev 18523 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 18518 | Rev 18521 | ||
---|---|---|---|
Line 2032... | Line 2032... | ||
2032 | double gamma; |
2032 | double gamma; |
2033 | if (pd[1]*pd[1]+pd[0]*pd[0] > pd[2]*pd[2]+pd[3]*pd[3]) |
2033 | if (pd[1]*pd[1]+pd[0]*pd[0] > pd[2]*pd[2]+pd[3]*pd[3]) |
2034 | gamma = atan2(pd[1],pd[0]); |
2034 | gamma = atan2(pd[1],pd[0]); |
2035 | else |
2035 | else |
2036 | gamma = atan2(pd[3],pd[2]); |
2036 | gamma = atan2(pd[3],pd[2]); |
2037 |
|
2037 | res[0]=cos(gamma); |
2038 |
|
2038 | res[1]=sin(gamma); |
2039 |
|
2039 | res[2]=-cos(gamma); |
2040 |
|
2040 | res[3]=-sin(gamma); |
2041 |
|
2041 | scale(res,pm->p,2); |
2042 |
|
2042 | gdImageLine(image,pm->p[0],pm->p[1],pm->p[2],pm->p[3],pm->color[0]); |
2043 |
|
2043 | if(tikz_file) fprintf(tikz_file, "(%i,%i)--(%i,%i)", |
2044 | pm->p[0],flip(pm->p[1]),pm->p[2],flip(pm->p[3])); |
2044 | pm->p[0],flip(pm->p[1]),pm->p[2],flip(pm->p[3])); |
2045 | } |
2045 | } |
2046 |
|
2046 | if (tikz_file) fprintf(tikz_file, ";\n"); |
- | 2047 | } |
|
- | 2048 | /* R=tanh(rhyp/2), z=\frac{1-R^2}{1-R^2|Z|^2} Z, r=\frac{1-|Z|^2}{1-R^2|Z|^2} R */ |
|
- | 2049 | void obj_hypcircles(objparm *pm) |
|
- | 2050 | { |
|
- | 2051 | int i, intbuf[2]; |
|
- | 2052 | double R,Z2,R2,den,r,XY,dbuf[2],*pd=pm->pd; |
|
- | 2053 | if (tikz_file) fprintf(tikz_file,"\\draw\[%s]",tikz_options(pm->color[0],pm->fill)); |
|
- | 2054 | for(i=0;i<pm->pcnt;i+=3){ |
|
- | 2055 | Z2=pd[i]*pd[i]+pd[i+1]*pd[i+1]; |
|
- | 2056 | R=tanh(pd[i+2]/2); R2=R*R; |
|
- | 2057 | den=1-R2*Z2; XY=(1-R2)/den; |
|
- | 2058 | dbuf[0]=XY*pd[i]; dbuf[1]=XY*pd[i+1]; |
|
- | 2059 | scale(dbuf,intbuf,1); |
|
- | 2060 | r=(1-Z2)/den*R; |
|
- | 2061 | gdImageArc(image,intbuf[0],intbuf[1],rint(2*r*xscale),rint(2*r*xscale),0,360,pm->color[0]); |
|
- | 2062 | if (tikz_file){ |
|
- | 2063 | fprintf(tikz_file, "(%i, %i) circle (%i and %i)", |
|
- | 2064 | intbuf[0],flip(intbuf[1]),(int) rint(r*xscale),(int) rint(r*xscale)); |
|
- | 2065 | } |
|
- | 2066 | } |
|
- | 2067 | if (tikz_file) fprintf(tikz_file, ";\n"); |
|
2047 | } |
2068 | } |