Compare commits
3 Commits
5fb1b809e1
...
03b26558ee
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03b26558ee | ||
|
|
4263302e46 | ||
|
|
90379c0a0f |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -9,4 +9,4 @@
|
||||
spirale
|
||||
starfield
|
||||
randomwalk
|
||||
|
||||
oscilloscope
|
||||
|
||||
10
Makefile
10
Makefile
@@ -28,6 +28,16 @@ randomwalk.png: randomwalk Makefile
|
||||
|
||||
# -----------------------------------------------
|
||||
|
||||
oscilloscope: oscilloscope.f90 Makefile genplotting.o
|
||||
gfortran -Wall $< genplotting.o -o $@
|
||||
|
||||
oscilloscope.png: oscilloscope Makefile
|
||||
./oscilloscope
|
||||
genplot2 -s 512x512 WS/oscilloscope.scratch a.tga
|
||||
convert a.tga $@
|
||||
|
||||
# -----------------------------------------------
|
||||
|
||||
spirale: spirale.f90 Makefile genplotting.o
|
||||
gfortran -Wall $< genplotting.o -o $@
|
||||
|
||||
|
||||
@@ -80,14 +80,14 @@ subroutine genp_end (foo)
|
||||
integer, intent(in) :: foo
|
||||
|
||||
write (0, '("--- genp_end ---")')
|
||||
write (0, '("minmax X", 2F16.5)') xmin, xmax
|
||||
write (0, '("minmax Y", 2F16.5)') ymin, ymax
|
||||
write (0, '("minmax X ", 2F18.5)') xmin, xmax
|
||||
write (0, '("minmax Y ", 2F18.5)') ymin, ymax
|
||||
|
||||
write (outunit, '(2F16.5, I6)') xmin*1.05, ymin*1.05, -1
|
||||
write (outunit, '(2F16.5, I6)') xmin*1.05, ymax*1.05, 0
|
||||
write (outunit, '(2F16.5, I6)') xmax*1.05, ymax*1.05, 0
|
||||
write (outunit, '(2F16.5, I6)') xmax*1.05, ymin*1.05, 0
|
||||
write (outunit, '(2F16.5, I6)') xmin*1.05, ymin*1.05, 0
|
||||
write (outunit, '(2F18.5, I6)') xmin*1.05, ymin*1.05, -1
|
||||
write (outunit, '(2F18.5, I6)') xmin*1.05, ymax*1.05, 0
|
||||
write (outunit, '(2F18.5, I6)') xmax*1.05, ymax*1.05, 0
|
||||
write (outunit, '(2F18.5, I6)') xmax*1.05, ymin*1.05, 0
|
||||
write (outunit, '(2F18.5, I6)') xmin*1.05, ymin*1.05, 0
|
||||
close (outunit)
|
||||
|
||||
if (6 .ne. outunit) then
|
||||
|
||||
62
oscilloscope.f90
Normal file
62
oscilloscope.f90
Normal file
@@ -0,0 +1,62 @@
|
||||
program oscilloscope
|
||||
use genplotting
|
||||
implicit none
|
||||
|
||||
real, dimension(4) :: frequences
|
||||
|
||||
write (0, '(A)') "----[ genplotting oscilloscope ]----"
|
||||
call srand(time())
|
||||
call genp_init (0, 'WS/oscilloscope.scratch')
|
||||
|
||||
frequences(1) = 0.86
|
||||
frequences(2) = 1.77
|
||||
frequences(3) = 1.56
|
||||
frequences(4) = 3.04
|
||||
|
||||
call do_oscilloscope(frequences, 1)
|
||||
call genp_end (0)
|
||||
contains
|
||||
! ---------------------------------------------------------
|
||||
subroutine plot_axes(amp)
|
||||
real, intent(in) :: amp
|
||||
call genp_move(0.0, -amp)
|
||||
call genp_draw(0.0, amp, 7)
|
||||
call genp_move(-amp, 0.0)
|
||||
call genp_draw( amp, 0.0, 7)
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
subroutine plot_a_trace(freq, phy, nbsteps, ypos)
|
||||
real, intent(in) :: freq, phy, ypos
|
||||
integer, intent(in) :: nbsteps
|
||||
|
||||
integer idx
|
||||
real rstep, px, py
|
||||
logical firstdot
|
||||
|
||||
firstdot = .true.
|
||||
do idx=0, nbsteps
|
||||
rstep = (real(idx)/real(nbsteps))
|
||||
px = -10.0 + (20.0 * rstep)
|
||||
py = ypos + sin(15*(rstep+phy)*freq)
|
||||
if (firstdot) then
|
||||
call genp_move(px, py) ; firstdot = .false.
|
||||
else
|
||||
call genp_draw(px, py, 2)
|
||||
endif
|
||||
enddo
|
||||
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
subroutine do_oscilloscope(freqs, col)
|
||||
real, intent(in), dimension(4) :: freqs
|
||||
integer, intent(in) :: col
|
||||
|
||||
call plot_a_trace(freqs(1), 0.2, 90, 6.66)
|
||||
call plot_a_trace(freqs(2), 1.0, 90, 3.33)
|
||||
call plot_a_trace(freqs(3), 2.6, 90, -3.33)
|
||||
call plot_a_trace(freqs(4), 3.9, 90, -6.66)
|
||||
call plot_axes(10.0)
|
||||
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
end program
|
||||
@@ -7,15 +7,19 @@ program randomwalk
|
||||
use genplotting
|
||||
implicit none
|
||||
integer foo, col
|
||||
|
||||
real px, py
|
||||
write (0, '(A)') "----[ genplotting randomwalk ]----"
|
||||
call srand(time())
|
||||
call genp_init (0, 'WS/randomwalk.scratch')
|
||||
do foo=1, 51
|
||||
col = 2 + mod(foo, 4)
|
||||
call do_randomwalk(42, col)
|
||||
do foo=1, 20
|
||||
px = 100 * (rand(0) - 0.50)
|
||||
py = 100 * (rand(0) - 0.50)
|
||||
call genp_set_offset(px, py)
|
||||
col = 1 + mod(foo, 6)
|
||||
call do_randomwalk(500, col)
|
||||
enddo
|
||||
call genp_end (0)
|
||||
stop
|
||||
contains
|
||||
! ---------------------------------------------------------
|
||||
subroutine do_randomwalk(nbre, col)
|
||||
@@ -23,13 +27,14 @@ subroutine do_randomwalk(nbre, col)
|
||||
integer :: idx
|
||||
real :: px, py, px2, py2
|
||||
|
||||
px = 0.0 ; py = 0.0
|
||||
px = 0.0 ; py = 0.0
|
||||
do idx=1, nbre
|
||||
px2 = px + rand(0) - 0.50
|
||||
py2 = py + rand(0) - 0.50
|
||||
call genp_line(px, py, px2, py2, col)
|
||||
px = px2 ; py = py2
|
||||
enddo
|
||||
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
end program
|
||||
|
||||
Reference in New Issue
Block a user