1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
| program fl
implicit none
real::r1,r2,d,theta,pi,a,N
integer:: l ,j,i
real,dimension(:), allocatable:: courbe
character(len=23):: Epitrochoid, Hypotrochoid,FMT,Nombres, des, points,erreurs,OK
pi=4.d0*atan(1.d0)
print*,'Epitrochoid=',1
print*,'Hypotrochoid=',2
write(*,*)"a="
read(*,*) a
write(*,*)"l" ! nombre des fleurs
read(*,*) l
do j=1,l
allocate(courbe(2*l))
WRITE(fmt,'(i3.1)') 2*l
fmt="("//trim(adjustl (fmt))//"ES13.3)"
!read(300,'(ES13.3)')fmt
open(unit=300,file='structure.data',status='unknown',form='formatted')
!k=j-1
write(*,*)"r1" !rayon de cercle fixe
read(*,*)r1
print*,'Nombres des points '
write(*,*)"N"
read(*,*)N
write(*,*)"r2"
read(*,*)r2
write(*,*)"d"
read(*,*)d
if(r1.GT.r2) then !!!!!!!!!!! condition sur r1 et r2 il faut r1>r2
print*,'OK'
else
print*,'erreurs'
end if
theta=0
do i=0,N
theta=2*pi*r1*i/N
if (a.EQ.1) then
courbe(2*j-1)= x1(theta,r1,r2,d)
courbe(2*j)=y1(theta,r1,r2,d)
write(300,fmt) courbe
else
courbe(2*j-1)=x2(theta,r1,r2,d)
courbe(2*j)=y2(theta,r1,r2,d)
!print*,'courbe=',courbe(:)
write(300,fmt) i,courbe
end if
! if(courbe.NE.0)
end do
deallocate(courbe)
end do
close(unit=300)
contains
!!!!!!!!!!!! Hypotrochoid!!!!!!!!!!!!!!!
function x1(theta,r1,r2,d)
implicit none
real::x1
real,intent(in):: theta,r1,r2,d
x1=(r1-r2)*cos(theta)+d*cos((r1-r2)*theta/r2)
end function
function y1(theta,r1,r2,d)
implicit none
real::y1
real,intent(in):: theta,r1,r2,d
y1=(r1-r2)*sin(theta)-d*sin((r1-r2)*theta/r2)
end function
!!!!!!!!!!!!!!! Epitrochoid!!!!!!!!!!!!!!!!!!
function x2(theta,r1,r2,d)
implicit none
real::x2
real,intent(in):: theta,r1,r2,d
x2=(r1+r2)*cos(theta)-d*cos((r1+r2)*theta/r2)
end function
function y2(theta,r1,r2,d)
implicit none
real::y2
real,intent(in):: theta,r1,r2,d
y2=(r1+r2)*sin(theta)-d*sin((r1+r2)*theta/r2)
end function
end program fl |
Partager