TropicalLine1pt a tropical line constructed using its centre point 1 1 0 -1 -1 0 2 1 3 1 4 1 TropicalLine2pt The stable tropical line passing through two points -1 0 def calc( arg1, arg2 ): c=max(arg1.coordinate().x+arg2.coordinate().y,arg1.coordinate().y+arg2.coordinate().x) a=max(arg2.coordinate().y,arg1.coordinate().y) b=max(arg1.coordinate().x,arg2.coordinate().x) return Point(Coordinate(c-a,c-b)) 4 5 1 2 1 1 0 -1 3 6 6 7 6 8 6 TropicalLineLineIntersection The stable intersection of two tropical lines, to select a tropical line, select its centre point def calc( arg1, arg2 ): c=max(-arg1.coordinate().x-arg2.coordinate().y,-arg1.coordinate().y-arg2.coordinate().x) a=max(-arg2.coordinate().y,-arg1.coordinate().y) b=max(-arg1.coordinate().x,-arg2.coordinate().x) return Point(Coordinate(a-c,b-c)) 3 4 1 2 TropicalConic Stable Conic Passing through 5 points def calc( arg1, arg2, arg3, arg4, arg5 ): #esto es el par 34 ax=arg1.coordinate().x ay=arg1.coordinate().y bx=arg2.coordinate().x by=arg2.coordinate().y cx=arg3.coordinate().x cy=arg3.coordinate().y dx=arg4.coordinate().x dy=arg4.coordinate().y ex=arg5.coordinate().x ey=arg5.coordinate().y def determinante5(a11,a12,a13,a14,a15,a21,a22,a23,a24,a25,a31,a32,a33,a34,a35,a41,a42,a43,a44,a45,a51,a52,a53,a54,a55): return max(a11+determinante4(a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a21+determinante4(a12,a13,a14,a15,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a31+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a42,a43,a44,a45,a52,a53,a5 4,a55),a41+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a52,a53,a54,a55),a51+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45)) def determinante4(a11,a12,a13,a14,a21,a22,a23,a24,a31,a32,a33,a34,a41,a42,a43,a44): return max(a11+determinante3(a22,a23,a24,a32,a33,a34,a42,a43,a44),a21+determinante3(a12,a13,a14,a32,a33,a34,a42,a43,a44),a31+determinante3(a12,a13,a14,a22,a23,a24,a42,a43,a44),a41+determinante3(a12,a13,a14,a22,a23,a24,a32,a33,a34)) def determinante3(a11,a12,a13,a21,a22,a23,a31,a32,a33): return max(a11+a22+a33,a12+a23+a31,a21+a32+a13,a31+a22+a13,a32+a23+a11,a21+a12+a33) l1=determinante5(ax,ay,ax+ay,2*ax,2*ay,bx,by,bx+by,2*bx,2*by,cx,cy,cx+cy,2*cx,2*cy,dx,dy,dx+dy,2*dx,2*dy,ex,ey,ex+ey,2*ex,2*ey) lx=determinante5(0,ay,ax+ay,2*ax,2*ay,0,by,bx+by,2*bx,2*by,0,cy,cx+cy,2*cx,2*cy,0,dy,dx+dy,2*dx,2*dy,0,ey,ex+ey,2*ex,2*ey) ly=determinante5(0,ax,ax+ay,2*ax,2*ay,0,bx,bx+by,2*bx,2*by,0,cx,cx+cy,2*cx,2*cy,0,dx,dx+dy,2*dx,2*dy,0,ex,ex+ey,2*ex,2*ey) lxy=determinante5(0,ax,ay,2*ax,2*ay,0,bx,by,2*bx,2*by,0,cx,cy,2*cx,2*cy,0,dx,dy,2*dx,2*dy,0,ex,ey,2*ex,2*ey) lxx=determinante5(0,ax,ay,ax+ay,2*ay,0,bx,by,bx+by,2*by,0,cx,cy,cx+cy,2*cy,0,dx,dy,dx+dy,2*dy,0,ex,ey,ex+ey,2*ey) lyy=determinante5(0,ax,ay,ax+ay,2*ax,0,bx,by,bx+by,2*bx,0,cx,cy,cx+cy,2*cx,0,dx,dy,dx+dy,2*dx,0,ex,ey,ex+ey,2*ex) #recta soporte es y=2x-ly+lxx pmx=max((l1-lxx)/2,lx-lxx) pMx=min(ly-(lxx+lyy)/2,ly-lxy) if pmx >pMx: Final=InvalidObject() else: Final=Segment(Coordinate(pmx,2*pmx-ly+lxx),Coordinate(pMx,2*pMx-ly+lxx)) return Final 6 def calc( arg1, arg2, arg3, arg4, arg5 ): #esto es el par 26 ax=arg1.coordinate().x ay=arg1.coordinate().y bx=arg2.coordinate().x by=arg2.coordinate().y cx=arg3.coordinate().x cy=arg3.coordinate().y dx=arg4.coordinate().x dy=arg4.coordinate().y ex=arg5.coordinate().x ey=arg5.coordinate().y def determinante5(a11,a12,a13,a14,a15,a21,a22,a23,a24,a25,a31,a32,a33,a34,a35,a41,a42,a43,a44,a45,a51,a52,a53,a54,a55): return max(a11+determinante4(a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a21+determinante4(a12,a13,a14,a15,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a31+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a42,a43,a44,a45,a52,a53,a5 4,a55),a41+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a52,a53,a54,a55),a51+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45)) def determinante4(a11,a12,a13,a14,a21,a22,a23,a24,a31,a32,a33,a34,a41,a42,a43,a44): return max(a11+determinante3(a22,a23,a24,a32,a33,a34,a42,a43,a44),a21+determinante3(a12,a13,a14,a32,a33,a34,a42,a43,a44),a31+determinante3(a12,a13,a14,a22,a23,a24,a42,a43,a44),a41+determinante3(a12,a13,a14,a22,a23,a24,a32,a33,a34)) def determinante3(a11,a12,a13,a21,a22,a23,a31,a32,a33): return max(a11+a22+a33,a12+a23+a31,a21+a32+a13,a31+a22+a13,a32+a23+a11,a21+a12+a33) l1=determinante5(ax,ay,ax+ay,2*ax,2*ay,bx,by,bx+by,2*bx,2*by,cx,cy,cx+cy,2*cx,2*cy,dx,dy,dx+dy,2*dx,2*dy,ex,ey,ex+ey,2*ex,2*ey) lx=determinante5(0,ay,ax+ay,2*ax,2*ay,0,by,bx+by,2*bx,2*by,0,cy,cx+cy,2*cx,2*cy,0,dy,dx+dy,2*dx,2*dy,0,ey,ex+ey,2*ex,2*ey) ly=determinante5(0,ax,ax+ay,2*ax,2*ay,0,bx,bx+by,2*bx,2*by,0,cx,cx+cy,2*cx,2*cy,0,dx,dx+dy,2*dx,2*dy,0,ex,ex+ey,2*ex,2*ey) lxy=determinante5(0,ax,ay,2*ax,2*ay,0,bx,by,2*bx,2*by,0,cx,cy,2*cx,2*cy,0,dx,dy,2*dx,2*dy,0,ex,ey,2*ex,2*ey) lxx=determinante5(0,ax,ay,ax+ay,2*ay,0,bx,by,bx+by,2*by,0,cx,cy,cx+cy,2*cy,0,dx,dy,dx+dy,2*dy,0,ex,ey,ex+ey,2*ey) lyy=determinante5(0,ax,ay,ax+ay,2*ax,0,bx,by,bx+by,2*bx,0,cx,cy,cx+cy,2*cx,0,dx,dy,dx+dy,2*dx,0,ex,ey,ex+ey,2*ex) #recta soporte es x=2y-lx+lyy pmy=max((l1-lyy)/2,ly-lyy) pMy=min(lx-(lxx+lyy)/2,lx-lxy) if pmy >pMy: Final=InvalidObject() else: Final=Segment(Coordinate(2*pmy-lx+lyy,pmy),Coordinate(2*pMy-lx+lyy,pMy)) return Final 8 def calc( arg1, arg2, arg3, arg4, arg5 ): #esto es el par 15 ax=arg1.coordinate().x ay=arg1.coordinate().y bx=arg2.coordinate().x by=arg2.coordinate().y cx=arg3.coordinate().x cy=arg3.coordinate().y dx=arg4.coordinate().x dy=arg4.coordinate().y ex=arg5.coordinate().x ey=arg5.coordinate().y def determinante5(a11,a12,a13,a14,a15,a21,a22,a23,a24,a25,a31,a32,a33,a34,a35,a41,a42,a43,a44,a45,a51,a52,a53,a54,a55): return max(a11+determinante4(a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a21+determinante4(a12,a13,a14,a15,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a31+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a42,a43,a44,a45,a52,a53,a5 4,a55),a41+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a52,a53,a54,a55),a51+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45)) def determinante4(a11,a12,a13,a14,a21,a22,a23,a24,a31,a32,a33,a34,a41,a42,a43,a44): return max(a11+determinante3(a22,a23,a24,a32,a33,a34,a42,a43,a44),a21+determinante3(a12,a13,a14,a32,a33,a34,a42,a43,a44),a31+determinante3(a12,a13,a14,a22,a23,a24,a42,a43,a44),a41+determinante3(a12,a13,a14,a22,a23,a24,a32,a33,a34)) def determinante3(a11,a12,a13,a21,a22,a23,a31,a32,a33): return max(a11+a22+a33,a12+a23+a31,a21+a32+a13,a31+a22+a13,a32+a23+a11,a21+a12+a33) l1=determinante5(ax,ay,ax+ay,2*ax,2*ay,bx,by,bx+by,2*bx,2*by,cx,cy,cx+cy,2*cx,2*cy,dx,dy,dx+dy,2*dx,2*dy,ex,ey,ex+ey,2*ex,2*ey) lx=determinante5(0,ay,ax+ay,2*ax,2*ay,0,by,bx+by,2*bx,2*by,0,cy,cx+cy,2*cx,2*cy,0,dy,dx+dy,2*dx,2*dy,0,ey,ex+ey,2*ex,2*ey) ly=determinante5(0,ax,ax+ay,2*ax,2*ay,0,bx,bx+by,2*bx,2*by,0,cx,cx+cy,2*cx,2*cy,0,dx,dx+dy,2*dx,2*dy,0,ex,ex+ey,2*ex,2*ey) lxy=determinante5(0,ax,ay,2*ax,2*ay,0,bx,by,2*bx,2*by,0,cx,cy,2*cx,2*cy,0,dx,dy,2*dx,2*dy,0,ex,ey,2*ex,2*ey) lxx=determinante5(0,ax,ay,ax+ay,2*ay,0,bx,by,bx+by,2*by,0,cx,cy,cx+cy,2*cy,0,dx,dy,dx+dy,2*dy,0,ex,ey,ex+ey,2*ey) lyy=determinante5(0,ax,ay,ax+ay,2*ax,0,bx,by,bx+by,2*bx,0,cx,cy,cx+cy,2*cx,0,dx,dy,dx+dy,2*dx,0,ex,ey,ex+ey,2*ex) #recta soporte es x+y=l1-lxy ==> x=-y+l1-lxy pmy=max(lx-lxy,(lxx+l1)/2-lxy) pMy=min(l1-ly,(l1-lyy)/2) if pmy >pMy: Final=InvalidObject() else: Final=Segment(Coordinate(-pmy+l1-lxy,pmy),Coordinate(-pMy+l1-lxy,pMy)) return Final 10 def calc( arg1, arg2, arg3, arg4, arg5 ): #esto es el par 65 ax=arg1.coordinate().x ay=arg1.coordinate().y bx=arg2.coordinate().x by=arg2.coordinate().y cx=arg3.coordinate().x cy=arg3.coordinate().y dx=arg4.coordinate().x dy=arg4.coordinate().y ex=arg5.coordinate().x ey=arg5.coordinate().y def determinante5(a11,a12,a13,a14,a15,a21,a22,a23,a24,a25,a31,a32,a33,a34,a35,a41,a42,a43,a44,a45,a51,a52,a53,a54,a55): return max(a11+determinante4(a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a21+determinante4(a12,a13,a14,a15,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a31+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a42,a43,a44,a45,a52,a53,a5 4,a55),a41+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a52,a53,a54,a55),a51+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45)) def determinante4(a11,a12,a13,a14,a21,a22,a23,a24,a31,a32,a33,a34,a41,a42,a43,a44): return max(a11+determinante3(a22,a23,a24,a32,a33,a34,a42,a43,a44),a21+determinante3(a12,a13,a14,a32,a33,a34,a42,a43,a44),a31+determinante3(a12,a13,a14,a22,a23,a24,a42,a43,a44),a41+determinante3(a12,a13,a14,a22,a23,a24,a32,a33,a34)) def determinante3(a11,a12,a13,a21,a22,a23,a31,a32,a33): return max(a11+a22+a33,a12+a23+a31,a21+a32+a13,a31+a22+a13,a32+a23+a11,a21+a12+a33) l1=determinante5(ax,ay,ax+ay,2*ax,2*ay,bx,by,bx+by,2*bx,2*by,cx,cy,cx+cy,2*cx,2*cy,dx,dy,dx+dy,2*dx,2*dy,ex,ey,ex+ey,2*ex,2*ey) lx=determinante5(0,ay,ax+ay,2*ax,2*ay,0,by,bx+by,2*bx,2*by,0,cy,cx+cy,2*cx,2*cy,0,dy,dx+dy,2*dx,2*dy,0,ey,ex+ey,2*ex,2*ey) ly=determinante5(0,ax,ax+ay,2*ax,2*ay,0,bx,bx+by,2*bx,2*by,0,cx,cx+cy,2*cx,2*cy,0,dx,dx+dy,2*dx,2*dy,0,ex,ex+ey,2*ex,2*ey) lxy=determinante5(0,ax,ay,2*ax,2*ay,0,bx,by,2*bx,2*by,0,cx,cy,2*cx,2*cy,0,dx,dy,2*dx,2*dy,0,ex,ey,2*ex,2*ey) lxx=determinante5(0,ax,ay,ax+ay,2*ay,0,bx,by,bx+by,2*by,0,cx,cy,cx+cy,2*cy,0,dx,dy,dx+dy,2*dy,0,ex,ey,ex+ey,2*ey) lyy=determinante5(0,ax,ay,ax+ay,2*ax,0,bx,by,bx+by,2*bx,0,cx,cy,cx+cy,2*cx,0,dx,dy,dx+dy,2*dx,0,ex,ey,ex+ey,2*ex) #recta soporte es 2y+lyy=lxy+x+y ==> y-x=lxy-lyy ==>x=y-lxy+lyy py=max((l1-lyy)/2,lx-lxy,ly-lyy) px=py-lxy+lyy if (lxx + lyy)/2-lxy>0: Final=InvalidObject() else: Final=Ray(Coordinate(px,py),Coordinate(px+1,py+1)) return Final 12 def calc( arg1, arg2, arg3, arg4, arg5 ): #esto es el par 46 ax=arg1.coordinate().x ay=arg1.coordinate().y bx=arg2.coordinate().x by=arg2.coordinate().y cx=arg3.coordinate().x cy=arg3.coordinate().y dx=arg4.coordinate().x dy=arg4.coordinate().y ex=arg5.coordinate().x ey=arg5.coordinate().y def determinante5(a11,a12,a13,a14,a15,a21,a22,a23,a24,a25,a31,a32,a33,a34,a35,a41,a42,a43,a44,a45,a51,a52,a53,a54,a55): return max(a11+determinante4(a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a21+determinante4(a12,a13,a14,a15,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a31+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a42,a43,a44,a45,a52,a53,a5 4,a55),a41+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a52,a53,a54,a55),a51+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45)) def determinante4(a11,a12,a13,a14,a21,a22,a23,a24,a31,a32,a33,a34,a41,a42,a43,a44): return max(a11+determinante3(a22,a23,a24,a32,a33,a34,a42,a43,a44),a21+determinante3(a12,a13,a14,a32,a33,a34,a42,a43,a44),a31+determinante3(a12,a13,a14,a22,a23,a24,a42,a43,a44),a41+determinante3(a12,a13,a14,a22,a23,a24,a32,a33,a34)) def determinante3(a11,a12,a13,a21,a22,a23,a31,a32,a33): return max(a11+a22+a33,a12+a23+a31,a21+a32+a13,a31+a22+a13,a32+a23+a11,a21+a12+a33) l1=determinante5(ax,ay,ax+ay,2*ax,2*ay,bx,by,bx+by,2*bx,2*by,cx,cy,cx+cy,2*cx,2*cy,dx,dy,dx+dy,2*dx,2*dy,ex,ey,ex+ey,2*ex,2*ey) lx=determinante5(0,ay,ax+ay,2*ax,2*ay,0,by,bx+by,2*bx,2*by,0,cy,cx+cy,2*cx,2*cy,0,dy,dx+dy,2*dx,2*dy,0,ey,ex+ey,2*ex,2*ey) ly=determinante5(0,ax,ax+ay,2*ax,2*ay,0,bx,bx+by,2*bx,2*by,0,cx,cx+cy,2*cx,2*cy,0,dx,dx+dy,2*dx,2*dy,0,ex,ex+ey,2*ex,2*ey) lxy=determinante5(0,ax,ay,2*ax,2*ay,0,bx,by,2*bx,2*by,0,cx,cy,2*cx,2*cy,0,dx,dy,2*dx,2*dy,0,ex,ey,2*ex,2*ey) lxx=determinante5(0,ax,ay,ax+ay,2*ay,0,bx,by,bx+by,2*by,0,cx,cy,cx+cy,2*cy,0,dx,dy,dx+dy,2*dy,0,ex,ey,ex+ey,2*ey) lyy=determinante5(0,ax,ay,ax+ay,2*ax,0,bx,by,bx+by,2*bx,0,cx,cy,cx+cy,2*cx,0,dx,dy,dx+dy,2*dx,0,ex,ey,ex+ey,2*ex) #recta soporte es y+ly=lyy+2y ==> y=ly-lyy py=ly-lyy px=min(2*ly-lyy-lx,(2*ly-lyy-lxx)/2,ly-lxy) if py <l1-ly: Final=InvalidObject() else: Final=Ray(Coordinate(px,py),Coordinate(px-1,py)) return Final 14 def calc( arg1, arg2, arg3, arg4, arg5 ): #esto es el par 45 ax=arg1.coordinate().x ay=arg1.coordinate().y bx=arg2.coordinate().x by=arg2.coordinate().y cx=arg3.coordinate().x cy=arg3.coordinate().y dx=arg4.coordinate().x dy=arg4.coordinate().y ex=arg5.coordinate().x ey=arg5.coordinate().y def determinante5(a11,a12,a13,a14,a15,a21,a22,a23,a24,a25,a31,a32,a33,a34,a35,a41,a42,a43,a44,a45,a51,a52,a53,a54,a55): return max(a11+determinante4(a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a21+determinante4(a12,a13,a14,a15,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a31+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a42,a43,a44,a45,a52,a53,a5 4,a55),a41+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a52,a53,a54,a55),a51+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45)) def determinante4(a11,a12,a13,a14,a21,a22,a23,a24,a31,a32,a33,a34,a41,a42,a43,a44): return max(a11+determinante3(a22,a23,a24,a32,a33,a34,a42,a43,a44),a21+determinante3(a12,a13,a14,a32,a33,a34,a42,a43,a44),a31+determinante3(a12,a13,a14,a22,a23,a24,a42,a43,a44),a41+determinante3(a12,a13,a14,a22,a23,a24,a32,a33,a34)) def determinante3(a11,a12,a13,a21,a22,a23,a31,a32,a33): return max(a11+a22+a33,a12+a23+a31,a21+a32+a13,a31+a22+a13,a32+a23+a11,a21+a12+a33) l1=determinante5(ax,ay,ax+ay,2*ax,2*ay,bx,by,bx+by,2*bx,2*by,cx,cy,cx+cy,2*cx,2*cy,dx,dy,dx+dy,2*dx,2*dy,ex,ey,ex+ey,2*ex,2*ey) lx=determinante5(0,ay,ax+ay,2*ax,2*ay,0,by,bx+by,2*bx,2*by,0,cy,cx+cy,2*cx,2*cy,0,dy,dx+dy,2*dx,2*dy,0,ey,ex+ey,2*ex,2*ey) ly=determinante5(0,ax,ax+ay,2*ax,2*ay,0,bx,bx+by,2*bx,2*by,0,cx,cx+cy,2*cx,2*cy,0,dx,dx+dy,2*dx,2*dy,0,ex,ex+ey,2*ex,2*ey) lxy=determinante5(0,ax,ay,2*ax,2*ay,0,bx,by,2*bx,2*by,0,cx,cy,2*cx,2*cy,0,dx,dy,2*dx,2*dy,0,ex,ey,2*ex,2*ey) lxx=determinante5(0,ax,ay,ax+ay,2*ay,0,bx,by,bx+by,2*by,0,cx,cy,cx+cy,2*cy,0,dx,dy,dx+dy,2*dy,0,ex,ey,ex+ey,2*ey) lyy=determinante5(0,ax,ay,ax+ay,2*ax,0,bx,by,bx+by,2*bx,0,cx,cy,cx+cy,2*cx,0,dx,dy,dx+dy,2*dx,0,ex,ey,ex+ey,2*ex) #recta soporte es y+ly=y+x+lxy ==> x=ly-lxy px=ly-lxy pmy=max(l1-ly,lx-lxy,lxx+ly-2*lxy) pMy=ly-lyy if pmy>pMy: Final=InvalidObject() else: Final=Segment(Coordinate(px,pmy),Coordinate(px,pMy)) return Final 16 def calc( arg1, arg2, arg3, arg4, arg5 ): #esto es el par 35 ax=arg1.coordinate().x ay=arg1.coordinate().y bx=arg2.coordinate().x by=arg2.coordinate().y cx=arg3.coordinate().x cy=arg3.coordinate().y dx=arg4.coordinate().x dy=arg4.coordinate().y ex=arg5.coordinate().x ey=arg5.coordinate().y def determinante5(a11,a12,a13,a14,a15,a21,a22,a23,a24,a25,a31,a32,a33,a34,a35,a41,a42,a43,a44,a45,a51,a52,a53,a54,a55): return max(a11+determinante4(a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a21+determinante4(a12,a13,a14,a15,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a31+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a42,a43,a44,a45,a52,a53,a5 4,a55),a41+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a52,a53,a54,a55),a51+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45)) def determinante4(a11,a12,a13,a14,a21,a22,a23,a24,a31,a32,a33,a34,a41,a42,a43,a44): return max(a11+determinante3(a22,a23,a24,a32,a33,a34,a42,a43,a44),a21+determinante3(a12,a13,a14,a32,a33,a34,a42,a43,a44),a31+determinante3(a12,a13,a14,a22,a23,a24,a42,a43,a44),a41+determinante3(a12,a13,a14,a22,a23,a24,a32,a33,a34)) def determinante3(a11,a12,a13,a21,a22,a23,a31,a32,a33): return max(a11+a22+a33,a12+a23+a31,a21+a32+a13,a31+a22+a13,a32+a23+a11,a21+a12+a33) l1=determinante5(ax,ay,ax+ay,2*ax,2*ay,bx,by,bx+by,2*bx,2*by,cx,cy,cx+cy,2*cx,2*cy,dx,dy,dx+dy,2*dx,2*dy,ex,ey,ex+ey,2*ex,2*ey) lx=determinante5(0,ay,ax+ay,2*ax,2*ay,0,by,bx+by,2*bx,2*by,0,cy,cx+cy,2*cx,2*cy,0,dy,dx+dy,2*dx,2*dy,0,ey,ex+ey,2*ex,2*ey) ly=determinante5(0,ax,ax+ay,2*ax,2*ay,0,bx,bx+by,2*bx,2*by,0,cx,cx+cy,2*cx,2*cy,0,dx,dx+dy,2*dx,2*dy,0,ex,ex+ey,2*ex,2*ey) lxy=determinante5(0,ax,ay,2*ax,2*ay,0,bx,by,2*bx,2*by,0,cx,cy,2*cx,2*cy,0,dx,dy,2*dx,2*dy,0,ex,ey,2*ex,2*ey) lxx=determinante5(0,ax,ay,ax+ay,2*ay,0,bx,by,bx+by,2*by,0,cx,cy,cx+cy,2*cy,0,dx,dy,dx+dy,2*dy,0,ex,ey,ex+ey,2*ey) lyy=determinante5(0,ax,ay,ax+ay,2*ax,0,bx,by,bx+by,2*bx,0,cx,cy,cx+cy,2*cx,0,dx,dy,dx+dy,2*dx,0,ex,ey,ex+ey,2*ex) #recta soporte es 2x+lxx=lxy+x+y ==> x-y=lxy-lxx ==>y=x-lxy+lxx px=max((l1-lxx)/2,lx-lxx,ly-lxy) py=px-lxy+lxx if (lyy + lxx)/2-lxy>0: Final=InvalidObject() else: Final=Ray(Coordinate(px,py),Coordinate(px+1,py+1)) return Final 18 def calc( arg1, arg2, arg3, arg4, arg5 ): #esto es el par 25 ax=arg1.coordinate().x ay=arg1.coordinate().y bx=arg2.coordinate().x by=arg2.coordinate().y cx=arg3.coordinate().x cy=arg3.coordinate().y dx=arg4.coordinate().x dy=arg4.coordinate().y ex=arg5.coordinate().x ey=arg5.coordinate().y def determinante5(a11,a12,a13,a14,a15,a21,a22,a23,a24,a25,a31,a32,a33,a34,a35,a41,a42,a43,a44,a45,a51,a52,a53,a54,a55): return max(a11+determinante4(a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a21+determinante4(a12,a13,a14,a15,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a31+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a42,a43,a44,a45,a52,a53,a5 4,a55),a41+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a52,a53,a54,a55),a51+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45)) def determinante4(a11,a12,a13,a14,a21,a22,a23,a24,a31,a32,a33,a34,a41,a42,a43,a44): return max(a11+determinante3(a22,a23,a24,a32,a33,a34,a42,a43,a44),a21+determinante3(a12,a13,a14,a32,a33,a34,a42,a43,a44),a31+determinante3(a12,a13,a14,a22,a23,a24,a42,a43,a44),a41+determinante3(a12,a13,a14,a22,a23,a24,a32,a33,a34)) def determinante3(a11,a12,a13,a21,a22,a23,a31,a32,a33): return max(a11+a22+a33,a12+a23+a31,a21+a32+a13,a31+a22+a13,a32+a23+a11,a21+a12+a33) l1=determinante5(ax,ay,ax+ay,2*ax,2*ay,bx,by,bx+by,2*bx,2*by,cx,cy,cx+cy,2*cx,2*cy,dx,dy,dx+dy,2*dx,2*dy,ex,ey,ex+ey,2*ex,2*ey) lx=determinante5(0,ay,ax+ay,2*ax,2*ay,0,by,bx+by,2*bx,2*by,0,cy,cx+cy,2*cx,2*cy,0,dy,dx+dy,2*dx,2*dy,0,ey,ex+ey,2*ex,2*ey) ly=determinante5(0,ax,ax+ay,2*ax,2*ay,0,bx,bx+by,2*bx,2*by,0,cx,cx+cy,2*cx,2*cy,0,dx,dx+dy,2*dx,2*dy,0,ex,ex+ey,2*ex,2*ey) lxy=determinante5(0,ax,ay,2*ax,2*ay,0,bx,by,2*bx,2*by,0,cx,cy,2*cx,2*cy,0,dx,dy,2*dx,2*dy,0,ex,ey,2*ex,2*ey) lxx=determinante5(0,ax,ay,ax+ay,2*ay,0,bx,by,bx+by,2*by,0,cx,cy,cx+cy,2*cy,0,dx,dy,dx+dy,2*dy,0,ex,ey,ex+ey,2*ey) lyy=determinante5(0,ax,ay,ax+ay,2*ax,0,bx,by,bx+by,2*bx,0,cx,cy,cx+cy,2*cx,0,dx,dy,dx+dy,2*dx,0,ex,ey,ex+ey,2*ex) #recta soporte es x+lx=y+x+lxy ==> y=lx-lxy py=lx-lxy pmx=max(l1-lx,ly-lxy,lyy+lx-2*lxy) pMx=lx-lxx if pmx>pMx: Final=InvalidObject() else: Final=Segment(Coordinate(pmx,py),Coordinate(pMx,py)) return Final 20 def calc( arg1, arg2, arg3, arg4, arg5 ): #esto es el par 24 ax=arg1.coordinate().x ay=arg1.coordinate().y bx=arg2.coordinate().x by=arg2.coordinate().y cx=arg3.coordinate().x cy=arg3.coordinate().y dx=arg4.coordinate().x dy=arg4.coordinate().y ex=arg5.coordinate().x ey=arg5.coordinate().y def determinante5(a11,a12,a13,a14,a15,a21,a22,a23,a24,a25,a31,a32,a33,a34,a35,a41,a42,a43,a44,a45,a51,a52,a53,a54,a55): return max(a11+determinante4(a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a21+determinante4(a12,a13,a14,a15,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a31+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a42,a43,a44,a45,a52,a53,a5 4,a55),a41+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a52,a53,a54,a55),a51+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45)) def determinante4(a11,a12,a13,a14,a21,a22,a23,a24,a31,a32,a33,a34,a41,a42,a43,a44): return max(a11+determinante3(a22,a23,a24,a32,a33,a34,a42,a43,a44),a21+determinante3(a12,a13,a14,a32,a33,a34,a42,a43,a44),a31+determinante3(a12,a13,a14,a22,a23,a24,a42,a43,a44),a41+determinante3(a12,a13,a14,a22,a23,a24,a32,a33,a34)) def determinante3(a11,a12,a13,a21,a22,a23,a31,a32,a33): return max(a11+a22+a33,a12+a23+a31,a21+a32+a13,a31+a22+a13,a32+a23+a11,a21+a12+a33) l1=determinante5(ax,ay,ax+ay,2*ax,2*ay,bx,by,bx+by,2*bx,2*by,cx,cy,cx+cy,2*cx,2*cy,dx,dy,dx+dy,2*dx,2*dy,ex,ey,ex+ey,2*ex,2*ey) lx=determinante5(0,ay,ax+ay,2*ax,2*ay,0,by,bx+by,2*bx,2*by,0,cy,cx+cy,2*cx,2*cy,0,dy,dx+dy,2*dx,2*dy,0,ey,ex+ey,2*ex,2*ey) ly=determinante5(0,ax,ax+ay,2*ax,2*ay,0,bx,bx+by,2*bx,2*by,0,cx,cx+cy,2*cx,2*cy,0,dx,dx+dy,2*dx,2*dy,0,ex,ex+ey,2*ex,2*ey) lxy=determinante5(0,ax,ay,2*ax,2*ay,0,bx,by,2*bx,2*by,0,cx,cy,2*cx,2*cy,0,dx,dy,2*dx,2*dy,0,ex,ey,2*ex,2*ey) lxx=determinante5(0,ax,ay,ax+ay,2*ay,0,bx,by,bx+by,2*by,0,cx,cy,cx+cy,2*cy,0,dx,dy,dx+dy,2*dy,0,ex,ey,ex+ey,2*ey) lyy=determinante5(0,ax,ay,ax+ay,2*ax,0,bx,by,bx+by,2*bx,0,cx,cy,cx+cy,2*cx,0,dx,dy,dx+dy,2*dx,0,ex,ey,ex+ey,2*ex) #recta soporte es x+lx=y+ly ==> x-y=ly-lx ==>x=y-lx+ly pmx=l1-lx pMx=min(ly-lxy,lx-lxx,2*ly-lx-lyy) if pmx>pMx: Final=InvalidObject() else: Final=Segment(Coordinate(pmx,pmx+lx-ly),Coordinate(pMx,pMx+lx-ly)) return Final 22 def calc( arg1, arg2, arg3, arg4, arg5 ): #esto es el par 14 ax=arg1.coordinate().x ay=arg1.coordinate().y bx=arg2.coordinate().x by=arg2.coordinate().y cx=arg3.coordinate().x cy=arg3.coordinate().y dx=arg4.coordinate().x dy=arg4.coordinate().y ex=arg5.coordinate().x ey=arg5.coordinate().y def determinante5(a11,a12,a13,a14,a15,a21,a22,a23,a24,a25,a31,a32,a33,a34,a35,a41,a42,a43,a44,a45,a51,a52,a53,a54,a55): return max(a11+determinante4(a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a21+determinante4(a12,a13,a14,a15,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a31+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a42,a43,a44,a45,a52,a53,a5 4,a55),a41+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a52,a53,a54,a55),a51+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45)) def determinante4(a11,a12,a13,a14,a21,a22,a23,a24,a31,a32,a33,a34,a41,a42,a43,a44): return max(a11+determinante3(a22,a23,a24,a32,a33,a34,a42,a43,a44),a21+determinante3(a12,a13,a14,a32,a33,a34,a42,a43,a44),a31+determinante3(a12,a13,a14,a22,a23,a24,a42,a43,a44),a41+determinante3(a12,a13,a14,a22,a23,a24,a32,a33,a34)) def determinante3(a11,a12,a13,a21,a22,a23,a31,a32,a33): return max(a11+a22+a33,a12+a23+a31,a21+a32+a13,a31+a22+a13,a32+a23+a11,a21+a12+a33) l1=determinante5(ax,ay,ax+ay,2*ax,2*ay,bx,by,bx+by,2*bx,2*by,cx,cy,cx+cy,2*cx,2*cy,dx,dy,dx+dy,2*dx,2*dy,ex,ey,ex+ey,2*ex,2*ey) lx=determinante5(0,ay,ax+ay,2*ax,2*ay,0,by,bx+by,2*bx,2*by,0,cy,cx+cy,2*cx,2*cy,0,dy,dx+dy,2*dx,2*dy,0,ey,ex+ey,2*ex,2*ey) ly=determinante5(0,ax,ax+ay,2*ax,2*ay,0,bx,bx+by,2*bx,2*by,0,cx,cx+cy,2*cx,2*cy,0,dx,dx+dy,2*dx,2*dy,0,ex,ex+ey,2*ex,2*ey) lxy=determinante5(0,ax,ay,2*ax,2*ay,0,bx,by,2*bx,2*by,0,cx,cy,2*cx,2*cy,0,dx,dy,2*dx,2*dy,0,ex,ey,2*ex,2*ey) lxx=determinante5(0,ax,ay,ax+ay,2*ay,0,bx,by,bx+by,2*by,0,cx,cy,cx+cy,2*cy,0,dx,dy,dx+dy,2*dy,0,ex,ey,ex+ey,2*ey) lyy=determinante5(0,ax,ay,ax+ay,2*ax,0,bx,by,bx+by,2*bx,0,cx,cy,cx+cy,2*cx,0,dx,dy,dx+dy,2*dx,0,ex,ey,ex+ey,2*ex) #recta soporte es y=l1-ly py=l1-ly px=min(l1-lx,ly-lxy,(l1-lxx)/2) if py >(l1-lyy)/2: Final=InvalidObject() else: Final=Ray(Coordinate(px,py),Coordinate(px-1,py)) return Final 24 def calc( arg1, arg2, arg3, arg4, arg5 ): #esto es el par 23 ax=arg1.coordinate().x ay=arg1.coordinate().y bx=arg2.coordinate().x by=arg2.coordinate().y cx=arg3.coordinate().x cy=arg3.coordinate().y dx=arg4.coordinate().x dy=arg4.coordinate().y ex=arg5.coordinate().x ey=arg5.coordinate().y def determinante5(a11,a12,a13,a14,a15,a21,a22,a23,a24,a25,a31,a32,a33,a34,a35,a41,a42,a43,a44,a45,a51,a52,a53,a54,a55): return max(a11+determinante4(a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a21+determinante4(a12,a13,a14,a15,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a31+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a42,a43,a44,a45,a52,a53,a5 4,a55),a41+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a52,a53,a54,a55),a51+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45)) def determinante4(a11,a12,a13,a14,a21,a22,a23,a24,a31,a32,a33,a34,a41,a42,a43,a44): return max(a11+determinante3(a22,a23,a24,a32,a33,a34,a42,a43,a44),a21+determinante3(a12,a13,a14,a32,a33,a34,a42,a43,a44),a31+determinante3(a12,a13,a14,a22,a23,a24,a42,a43,a44),a41+determinante3(a12,a13,a14,a22,a23,a24,a32,a33,a34)) def determinante3(a11,a12,a13,a21,a22,a23,a31,a32,a33): return max(a11+a22+a33,a12+a23+a31,a21+a32+a13,a31+a22+a13,a32+a23+a11,a21+a12+a33) l1=determinante5(ax,ay,ax+ay,2*ax,2*ay,bx,by,bx+by,2*bx,2*by,cx,cy,cx+cy,2*cx,2*cy,dx,dy,dx+dy,2*dx,2*dy,ex,ey,ex+ey,2*ex,2*ey) lx=determinante5(0,ay,ax+ay,2*ax,2*ay,0,by,bx+by,2*bx,2*by,0,cy,cx+cy,2*cx,2*cy,0,dy,dx+dy,2*dx,2*dy,0,ey,ex+ey,2*ex,2*ey) ly=determinante5(0,ax,ax+ay,2*ax,2*ay,0,bx,bx+by,2*bx,2*by,0,cx,cx+cy,2*cx,2*cy,0,dx,dx+dy,2*dx,2*dy,0,ex,ex+ey,2*ex,2*ey) lxy=determinante5(0,ax,ay,2*ax,2*ay,0,bx,by,2*bx,2*by,0,cx,cy,2*cx,2*cy,0,dx,dy,2*dx,2*dy,0,ex,ey,2*ex,2*ey) lxx=determinante5(0,ax,ay,ax+ay,2*ay,0,bx,by,bx+by,2*by,0,cx,cy,cx+cy,2*cy,0,dx,dy,dx+dy,2*dy,0,ex,ey,ex+ey,2*ey) lyy=determinante5(0,ax,ay,ax+ay,2*ax,0,bx,by,bx+by,2*bx,0,cx,cy,cx+cy,2*cx,0,dx,dy,dx+dy,2*dx,0,ex,ey,ex+ey,2*ex) #recta soporte es x+lx=lxx+2x ==> x=lx-lxx px=lx-lxx py=min(2*lx-lxx-ly,(2*lx-lxx-lyy)/2,lx-lxy) if px <l1-lx: Final=InvalidObject() else: Final=Ray(Coordinate(px,py),Coordinate(px,py-1)) return Final 26 def calc( arg1, arg2, arg3, arg4, arg5 ): #esto es el par 12 ax=arg1.coordinate().x ay=arg1.coordinate().y bx=arg2.coordinate().x by=arg2.coordinate().y cx=arg3.coordinate().x cy=arg3.coordinate().y dx=arg4.coordinate().x dy=arg4.coordinate().y ex=arg5.coordinate().x ey=arg5.coordinate().y def determinante5(a11,a12,a13,a14,a15,a21,a22,a23,a24,a25,a31,a32,a33,a34,a35,a41,a42,a43,a44,a45,a51,a52,a53,a54,a55): return max(a11+determinante4(a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a21+determinante4(a12,a13,a14,a15,a32,a33,a34,a35,a42,a43,a44,a45,a52,a53,a54,a55),a31+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a42,a43,a44,a45,a52,a53,a5 4,a55),a41+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a52,a53,a54,a55),a51+determinante4(a12,a13,a14,a15,a22,a23,a24,a25,a32,a33,a34,a35,a42,a43,a44,a45)) def determinante4(a11,a12,a13,a14,a21,a22,a23,a24,a31,a32,a33,a34,a41,a42,a43,a44): return max(a11+determinante3(a22,a23,a24,a32,a33,a34,a42,a43,a44),a21+determinante3(a12,a13,a14,a32,a33,a34,a42,a43,a44),a31+determinante3(a12,a13,a14,a22,a23,a24,a42,a43,a44),a41+determinante3(a12,a13,a14,a22,a23,a24,a32,a33,a34)) def determinante3(a11,a12,a13,a21,a22,a23,a31,a32,a33): return max(a11+a22+a33,a12+a23+a31,a21+a32+a13,a31+a22+a13,a32+a23+a11,a21+a12+a33) l1=determinante5(ax,ay,ax+ay,2*ax,2*ay,bx,by,bx+by,2*bx,2*by,cx,cy,cx+cy,2*cx,2*cy,dx,dy,dx+dy,2*dx,2*dy,ex,ey,ex+ey,2*ex,2*ey) lx=determinante5(0,ay,ax+ay,2*ax,2*ay,0,by,bx+by,2*bx,2*by,0,cy,cx+cy,2*cx,2*cy,0,dy,dx+dy,2*dx,2*dy,0,ey,ex+ey,2*ex,2*ey) ly=determinante5(0,ax,ax+ay,2*ax,2*ay,0,bx,bx+by,2*bx,2*by,0,cx,cx+cy,2*cx,2*cy,0,dx,dx+dy,2*dx,2*dy,0,ex,ex+ey,2*ex,2*ey) lxy=determinante5(0,ax,ay,2*ax,2*ay,0,bx,by,2*bx,2*by,0,cx,cy,2*cx,2*cy,0,dx,dy,2*dx,2*dy,0,ex,ey,2*ex,2*ey) lxx=determinante5(0,ax,ay,ax+ay,2*ay,0,bx,by,bx+by,2*by,0,cx,cy,cx+cy,2*cy,0,dx,dy,dx+dy,2*dy,0,ex,ey,ex+ey,2*ey) lyy=determinante5(0,ax,ay,ax+ay,2*ax,0,bx,by,bx+by,2*bx,0,cx,cy,cx+cy,2*cx,0,dx,dy,dx+dy,2*dx,0,ex,ey,ex+ey,2*ex) #recta soporte es x=l1-lx px=l1-lx py=min(l1-ly,lx-lxy,(l1-lyy)/2) if px >(l1-lxx)/2: Final=InvalidObject() else: Final=Ray(Coordinate(px,py),Coordinate(px,py-1)) return Final 28 7 5 2 4 1 3 9 5 2 4 1 3 11 5 2 4 1 3 13 5 2 4 1 3 15 5 2 4 1 3 17 5 2 4 1 3 19 5 2 4 1 3 21 5 2 4 1 3 23 5 2 4 1 3 25 5 2 4 1 3 27 5 2 4 1 3 29 5 2 4 1 3