Sunteți pe pagina 1din 29

# Proiectarea Asistata de Calculator pentru Avionica

## C3. Elemente de grafica integrata II

CUPRINS CURS
Biblioteca grafica, Aplicatii elementare ; Aplicatie de desenare integrata;

## BIBLIOTEAC GRAFICA GR.LIB

SUBROUTINE LINEA(x,y) c rutina de trasare a unei linii in coordonate absolute use ifqwin integer*2 status,x,y status = lineto(x,y) RETURN END

subroutine poli3(ix,iy) implicit real*8(a-h,o-z) integer*2 ix(3),iy(3) call movea(ix(1),iy(1)) call linea(ix(2),iy(2)) call linea(ix(3),iy(3)) call linea(ix(1),iy(1)) return end

subroutine poli4(ix,iy) implicit real*8(a-h,o-z) integer*2 ix(4),iy(4) call movea(ix(1),iy(1)) call linea(ix(2),iy(2)) call linea(ix(3),iy(3)) call linea(ix(4),iy(4)) call linea(ix(1),iy(1)) return end

SUBROUTINE POLY(IXX,IYY,j,nir) integer*2 IXX(10000,5),IYY(10000,5),j,nir if(nir.lt.2) return call movea(ixx(1,j),iyy(1,j)) do i=1,nir call linea(IXX(i,j),IYY(i,j)) end do RETURN END

subroutine SCERC(ixo,iyo,irf) real*8 pi integer*2 ixc(10000,5),iyc(10000,5),ixo,iyo,irf pi=4.*datan(1.d0) c trsare cerc do i=1,180 ixc(i,1)=ixo + int2(irf*dcos(i*pi/180)) iyc(i,1)=iyo - int2(irf*dsin(i*pi/180)) end do call poly(ixc,iyc,1,180) RETURN END

subroutine tra4(ix,iy,idx,idy) integer*2 ix(4),iy(4),idx,idy do i=1,4 ix(i)=ix(i)+idx iy(i)=iy(i)+idy end do return end

subroutine trans4(ix,iy,ixr,iyr,alfa) C c rutina de transformare prin translatie, rotire c urmata de wizualizare pentru un poligon cu 4 puncte C c ixr, iyr - coordonatele punctului in raport cu care se face rotirea c in pixeli, masurata de la originea ecranului (stanga sus) c alfa - unghiul de rotire in radiani real*8 alfa integer*2 ix(4), iy(4), ixr,iyr call tra4(ix,iy,-ixr,-iyr) call rot4(ix,iy,alfa) call tra4(ix,iy,ixr,iyr) call poli4(ix,iy) return END

APLICATII ELEMNTARE;

USE IFQWIN implicit real*8 (a-h,o-z) integer*2 width, height C INITIALIZAREA SUPRAFETEI DE VIZUALIZARE call inivs(width, height) C desenare in spatiu initializat call st(0) ! stilul de scriere si desenare ! text call movea(300,10) call outgtext("vedere normala") ! trasare linie call movea(200,200) call linea(400,400) call tervs stop END

## Aplicatie de desenare integrata;

subroutine graf C USE IFQWIN c rutina de reprezentare grafica a configuratiei C implicit real*8 (a-h,o-z) INTEGER*1 buffer[ALLOCATABLE] (:) INTEGER*2 error INTEGER*4 imsize,x1,x2,y1,y2, status integer*2 width, height,ir integer*2 ixdmin,ixdmax,iydmin,iydmax real*4 xmin, ymin, xmax, ymax character*50 te(30) character*13 par(20) dimension y(5000,40) integer*2 ix(500), iy(500),ixc(180,1),iyc(180,1) C INTRODUCERE DATE GEOMETRICE C pi=4.*datan(1.d0)

GEOMETRIA ARIPEI CALL GEOARI(2, & C0A,CEA,BA,SA,CMADA,ALAMBA,RA,XBCMAA,YCMAA,H0A,H50A, & H100A,HEA,E0A,ECMAA,EEA,A0MA,ACMAMA,AEMA,EPS0A, & EPSCMA,EPSEA,A0A,ACMAA,AEA,ACEA,TAU0A,TAU10A,XSA, & HISEA, AELA, CELA, YFEA ) C GEOMETRIA AMPENAJ ORIZONTAL CALL GEOARI(3, ! CITESTE FISIERUL AMPENAJo.GEO & C0O,CEO,BO,SO,CMADO,ALAMBO,RO,XBCMAO,YCMAO,H0O,H50O, & H100O,HEO,E0O,ECMAO,EEO,A0MO,ACMAMO,AEMO,EPS0O, & EPSCMO,EPSEO,A0O,ACMAO,AEO,ACEO,TAU0O,TAU10O,XSo, & HISEO, AELO, CELO, YFEO ) C GEOMETRIA AMPENAJ VERTICAL CALL GEOARI(6, ! CITESTE ampenajv.GEO & C0v,CEv,Bv,Sv,CMADv,ALAMBv,Rv,XBCMAv,ZCMAv,H0v,H50v, & H100v,HEv,E0v,ECMAv,EEv,A0Mv,ACMAMv,AEMv,EPS0v, & EPSCMv,EPSEv,A0v,ACMAv,AEv,ACEv,TAU0v,TAU10v,XSv, & HISEv, AELv, CELv, ZFEv ) c geometria fuzelaj call GEOFUS( & XLF,SF,DF,XLS,RF,XLV,XLC,XLP,ALF,ALV,ALC,ALP,SCIL, & SLAT,STERM,WV,WP,TETV,TETP,RVF,RP,IVIRF,IPOST) C geometrie ansamblu

C INITIALIZAREA SUPRAFETEI DE VIZUALIZARE Call inivs(width, height) C desenare in spatiu initializat call st(0) ! stilul de scriere si desenare ! text ! citire mesaje open(unit=1,file='GEO.DAT') do i=1,30 if(eof(1)) go to 577 read(1,14)te(i) end do 577 nmsg=i-1 close(unit=1) c reprezentare mesaje ir=20 do 578 i=1,nmsg ir=ir+15 CALL MOVEA(50,ir) call outgtext(te(i)) 578 continue

c definirea scarii prin raportare la lungimea fuzelajului iscr1 = int2(width * 0.90 / xlf) iscr2 = int2(height * 0.90 / (ba+df)) iscr= min(iscr1,iscr2) c adfimensionarea marimilor fuzelaj ilf=xlf*iscr ilv=xlv*iscr irv=rvf*iscr ilc=xlc*iscr ilp=xlp*iscr irf=rf*iscr irp=rp*iscr ils=xls*iscr irs=rs*iscr ixo=300 iyo=400

c adimensionarea lungimilor aripii iloa=XL0a*iscr ! pozitia aripii icoa=c0a*iscr ! coarda la incastrare icea=cea*iscr ! coarda la extremitate ibea=ba*iscr ! anvergura aripii reduse iaema=EEA*iscr/2 ! semigrosime maxima la extremitate iaoma=E0A*iscr/2 ! semigrosime maxima la incastrare ieoa = A0MA*iscr ! pozitie grosime maxima iyfe=yfea*iscr -irf ! y focar eleron da la incastrare ice =cela*iscr ! cma eleron ibe = aela*iscr ! semianvergura eleron ! hisea - ughiul de sageta ba eleron

c adimensionarea lungimilor ampenajului orizontal iloo=XL0o*iscr ! pozitia ampenajului orizontal icoo=c0o*iscr ! coarda la incastrare iceo=ceo*iscr ! coarda la extremitate ibeo=bo*iscr ! anvergura ampenaj oriz redus iaemo=EEO*iscr/2 ! semigrosime maxima la extremitate iaomo=E0O*iscr/2 ! semigrosime maxima la incastrare ieoo = A0MO*iscr ! pozitie grosime maxima iyfp=yfeo*iscr ! y focar profundor icp =celo*iscr ! cma profundor ibp = aelo*iscr ! semianvergura profundor ! hiseo - ughiul de sageta ba profundor

c adimensionarea lungimilor ampenajului vertical ilov=XL0v*iscr ! pozitia ampenajului vertical icov=c0v*iscr ! coarda la incastrare icev=cev*iscr ! coarda la extremitate ibev=bv*iscr ! anvergura ampenaj vertical redus iaemv=EEV*iscr/2 ! semigrosime maxima la extremitate iaomv=E0V*iscr/2 ! semigrosime maxima la incastrare ieov = A0MV*iscr ! pozitie grosime maxima iyfd=zfev*iscr -irs ! z focar directie icd =celv*iscr ! cma directie ibd = aelv*iscr ! semianvergura directie

c trasare axa de simetrie ! call movea(ixo,iyo) ! call linea(ixo+ilf,iyo) ! titlu call movea(300,10) call outgtext("PROIECTIE ORIZONTALA") c desenarea varfului: c portiunea sferica do i=1,180 ixc(i,1)=ixo + irv - int2(irv*dsin(i*pi/180)) iyc(i,1)=iyo + int2(irv*dcos(i*pi/180)) end do call poly(ixc,iyc,1,180) c portiunea conica ix(1)=ixo +irv iy(1)=iyo +irv ix(2)=ixo+ilv iy(2)=iyo+irf ix(3)=ix(2) iy(3)=iyo-irf ix(4)=ix(1) iy(4)=iyo-irv call poli4(ix,iy)

c desenarea cilindrului ix(1)=ixo+ilv iy(1)=iyo-irf ix(2)=ix(1)+ilc iy(2)=iy(1) ix(3)=ix(2) iy(3)=iyo+irf ix(4)=ix(1) iy(4)=iy(3) call poli4(ix,iy) c desenarea partii posterioare ix(1)=ixo+ilv+ilc iy(1)=iyo-irf ix(2)=ixo+ilf iy(2)=iyo-irp ix(3)=ix(2) iy(3)=iyo+irp ix(4)=ix(1) iy(4)=iyo+irf call poli4(ix,iy) c desenarea cozii ix(1)=ixo+ilf iy(1)=iyo-irs ix(2)=ixo+ilf+ils iy(2)=iyo-irs ix(3)=ix(2) iy(3)=iyo+irs ix(4)=ix(1) iy(4)=iyo+irs call poli4(ix,iy)

c desenarea aripii ( consola stanga ) ix(1)=ixo+iloa ! x incastrare BA iy(1)=iyo+irf ! y incastrare BA ix(2)=ixo+iloa+int2(ibea/2*dtan(H0A)) ! x extreemitate BA iy(2)=iyo+irf+int2(ibea/2) ! y extremitate BA ix(3)=ix(2)+icea ! x extremitate BF iy(3)=iy(2) ! y extremitate BF ix(4)=ix(1)+icoa ! x incastrare BF iy(4)=iy(1) ! y incastrare BF call poli4(ix,iy) c desenare eleron stanga c extremitati eleron iceb= ice + int2(ibe/2*(dtan(hisea)-dtan(h100a))) ! coarda eleron la baza icee= ice - int2(ibe/2*(dtan(hisea)-dtan(h100a))) ! coarda eleron la extr ix(1)=ixo+iloa+icoa+int2((iyfe-ibe/2)*dtan(H100A)) ! x eleron baza BF iy(1)=iyo+irf + int2(iyfe - ibe/2) ! y eleron baza BF ix(4)=ixo+iloa+icoa+int2((iyfe+ibe/2)*dtan(H100A)) ! x eleron extremitate BF iy(4)=iyo+irf + int2(iyfe + ibe/2) ! y eleron extremitate BF ix(2)=ix(1) - iceb ! x eleron baza BA iy(2)=iy(1) ! y eleron baza BA ix(3)=ix(4) - icee ! x eleron extr BA iy(3)=iy(4) ! y eleron extr BA call poli4(ix,iy)

c desenarea aripii ( consola dreapta ) ix(1)=ixo+iloa ! x incastrare BA iy(1)=iyo-irf ! y incastrare BA ix(2)=ixo+iloa+int2(ibea/2*dtan(H0A)) ! x extreemitate BA iy(2)=iyo-irf-int2(ibea/2) ! y extremitate BA ix(3)=ix(2)+icea ! x extremitate BF iy(3)=iy(2) ! y extremitate BF ix(4)=ix(1)+icoa ! x incastrare BF iy(4)=iy(1) ! y incastrare BF call poli4(ix,iy) c desenare eleron c extremitati eleron dreapta ix(1)=ixo+iloa+icoa+int2((iyfe-ibe/2)*dtan(H100A)) ! x eleron baza BF iy(1)=iyo-irf - int2(iyfe - ibe/2) ! y eleron baza BF ix(4)=ixo+iloa+icoa+int2((iyfe+ibe/2)*dtan(H100A)) ! x eleron extremitate BF iy(4)=iyo-irf - int2(iyfe + ibe/2) ! y eleron extremitate BF ix(2)=ix(1) - iceb iy(2)=iy(1) ix(3)=ix(4) - icee iy(3)=iy(4) call poli4(ix,iy)

c desenarea ampenajului orizontal ( consola stanga ) ix(1)=ixo+iloo ! x incastrare BA iy(1)=iyo ! y incastrare BA ix(2)=ixo+iloo+int2(ibeo/2*dtan(H0o)) !x extreemitate BA iy(2)=iyo+int2(ibeo/2) ! y extremitate BA ix(3)=ix(2)+iceo ! x extremitate BF iy(3)=iy(2) ! y extremitate BF ix(4)=ix(1)+icoo ! x incastrare BF iy(4)=iy(1) ! y incastrare BF call poli4(ix,iy)

c desenare profundor c extremitati profundor stinga icpb= icp + int2(ibp/2*(dtan(hiseo)-dtan(h100o))) ! coarda profundor la baza icpe= icp - int2(ibp/2*(dtan(hiseo)-dtan(h100o))) ! coarda profundor la extr ix(1)=ixo+iloo+icoo+int2((iyfp-ibp/2)*dtan(H100o)) ! x profundor baza BF iy(1)=iyo + int2(iyfp - ibp/2) ! y profundor baza BF ix(4)=ixo+iloo+icoo+int2((iyfp+ibp/2)*dtan(H100o)) ! x profundor extremitate BF iy(4)=iyo + int2(iyfp + ibp/2) ! y profundor extremitate BF ix(2)=ix(1) - icpb iy(2)=iy(1) ix(3)=ix(4) - icpe iy(3)=iy(4) call poli4(ix,iy)

c desenarea ampenajului orizontal ( consola dreapta ) ix(1)=ixo+iloo ! x incastrare BA iy(1)=iyo ! y incastrare BA ix(2)=ixo+iloo+int2(ibeo/2*dtan(H0o)) !x extreemitate BA iy(2)=iyo-int2(ibeo/2) ! y extremitate BA ix(3)=ix(2)+iceo ! x extremitate BF iy(3)=iy(2) ! y extremitate BF ix(4)=ix(1)+icoo ! x incastrare BF iy(4)=iy(1) ! y incastrare BF call poli4(ix,iy) c desenare profundor dreapta

c desenare profundor dreapta c extremitati profundor ix(1)=ixo+iloo+icoo+int2((iyfp-ibp/2)*dtan(H100o)) ! x profundor baza BF iy(1)=iyo - int2(iyfp - ibp/2) ! y profundor baza BF ix(4)=ixo+iloo+icoo+int2((iyfp+ibp/2)*dtan(H100o)) ! x profundor extremitate BF iy(4)=iyo - int2(iyfp + ibp/2) ! y profundor extremitate BF ix(2)=ix(1) - icpb iy(2)=iy(1) ix(3)=ix(4) - icpe iy(3)=iy(4) call poli4(ix,iy)

c trasare ampenaj vertical ix(1)= ixo + ilov iy(1)= iyo ix(2)= ix(1)+ieov iy(2)= iy(1)+iaomv ix(3)= ixo + ilov + icov iy(3)= iy(1) ix(4)= ix(2) iy(4)= iy(1)-iaomv call poli4(ix,iy) C INCHIDEREA SUPRAFETEI DE VIZUALIZARE call tervs