####################################### # GFR Rettangoli. # Rettangolo come c(bs,bd,ad,as) # per poter applicare polygon. Gfr = function (dx=NA,dy=NA, x1=NA,x2=NA,y1=NA,y2=NA,centro=NA) {if (P.def(centro)) {x=Re(centro); y=Im(centro) x1=x-dx/2; x2=x+dx/2 y1=y-dy/2; y2=y+dy/2} else if (P.def(x1,y1,dx,dy)) {x2=x1+dx; y2=y1+dy} else if (P.def(x1,y2,dx,dy)) {x2=x1+dx; y1=y2-dy} else if (P.def(x2,y1,dx,dy)) {x1=x2-dx; y2=y1+dy} else if (P.def(x2,y2,dx,dy)) {x1=x2-dx; y1=y2-dy} bs=x1+1i*y1; bd=x2+1i*y1 as=x1+1i*y2; ad=x2+1i*y2 c(bs,bd,ad,as)} Gfr.centro = function (r) (r[1]+r[3])/2 Gfr.dx = function (r) Re(r[2]-r[1]) Gfr.dy = function (r) Im(r[3]-r[2]) Gfr.x1 = function (r) Re(r[1]) Gfr.x2 = function (r) Re(r[2]) Gfr.y1 = function (r) Im(r[1]) Gfr.y2 = function (r) Im(r[3])