TetaTricks/code/fortran/dessiner.f90

67 lines
1.5 KiB
Fortran
Raw Normal View History

2023-03-07 20:49:36 +01:00
program dessiner
use plplot
implicit none
2023-03-21 00:16:54 +01:00
integer :: i
real :: a, b, c, d
2023-03-07 20:49:36 +01:00
character(len=80) :: version
call plgver(version)
write (*,'(a,a)') 'plplot version: ', trim(version)
call plsdev('xwin')
call plinit ()
call plenv(-2.2, 2.2, -2.2, 2.2, 0, 1)
2023-03-21 00:16:54 +01:00
a = 0
b = 0
c = 0
d = 0
do i=1, 100
a = a + 0.01
b = b + 0.02
call dessin_1 (a, b, 12)
c = c + 0.03
d = d + 0.04
call dessin_1 (c, d, 13)
enddo
2023-03-07 20:49:36 +01:00
call plend
2023-03-21 00:16:54 +01:00
contains ! -----------------------------
!------------------------------------------------------
subroutine dessin_1 (sha, shb, color)
real, intent(in) :: sha, shb
integer, intent(in) :: color
2023-03-07 20:49:36 +01:00
2023-03-21 00:16:54 +01:00
integer, parameter :: lg = 2000
2023-03-07 20:49:36 +01:00
real :: x(lg), y(lg)
2023-03-21 00:16:54 +01:00
real :: k, amp
2023-03-07 20:49:36 +01:00
integer :: i
2023-03-21 00:16:54 +01:00
! print *, 'dessin 1'
amp = 2.0
2023-03-07 20:49:36 +01:00
do i = 1, lg
2023-03-21 00:16:54 +01:00
k = real(i)/real(lg) * 6.2832 * 4.0
x(i) = amp * sin((k+sha)*5)
y(i) = amp * cos((k+shb)*3)
2023-03-07 20:49:36 +01:00
enddo
2023-03-21 00:16:54 +01:00
! print *, k, x(i), y(i)
2023-03-07 20:49:36 +01:00
call plcol0 (15) ! pure white
call pllab ("Fuzzfactor", "Yoyodines", "Some nice plots from tTh")
2023-03-21 00:16:54 +01:00
call plcol0 (color)
2023-03-07 20:49:36 +01:00
call plline (x, y)
end subroutine
2023-03-21 00:16:54 +01:00
!------------------------------------------------------
subroutine dessin_2 ()
print *, 'dessin 2'
end subroutine
!------------------------------------------------------
2023-03-07 20:49:36 +01:00
end program