+ lissajous plotter
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -10,3 +10,5 @@ spirale
|
||||
starfield
|
||||
randomwalk
|
||||
oscilloscope
|
||||
lissajous
|
||||
|
||||
|
||||
10
Makefile
10
Makefile
@@ -47,3 +47,13 @@ spirale.png: spirale Makefile
|
||||
convert a.tga $@
|
||||
|
||||
# -----------------------------------------------
|
||||
|
||||
lissajous: lissajous.f90 Makefile genplotting.o
|
||||
gfortran -Wall $< genplotting.o -o $@
|
||||
|
||||
lissajous.png: lissajous Makefile
|
||||
./lissajous
|
||||
genplot2 -s 512x512 WS/lissajous.scratch a.tga
|
||||
convert a.tga $@
|
||||
|
||||
# -----------------------------------------------
|
||||
|
||||
41
lissajous.f90
Normal file
41
lissajous.f90
Normal file
@@ -0,0 +1,41 @@
|
||||
program sinwaves
|
||||
use genplotting
|
||||
implicit none
|
||||
|
||||
integer foo, c
|
||||
real phase
|
||||
call genp_init (0, 'WS/lissajous.scratch')
|
||||
|
||||
do foo=1, 22
|
||||
phase = real(foo) * 0.314159
|
||||
c = 3 + mod(foo, 2)
|
||||
call do_lissajous (2000, phase, c)
|
||||
enddo
|
||||
|
||||
call genp_end (0)
|
||||
|
||||
contains
|
||||
! ---------------------------------------------------------
|
||||
subroutine do_lissajous (nbpass, phy, col)
|
||||
integer, intent(in) :: nbpass, col
|
||||
real, intent(in) :: phy
|
||||
|
||||
integer :: idx
|
||||
real :: ridx, x, y
|
||||
|
||||
do idx=0, nbpass
|
||||
ridx = 6.28318 * (real(idx) / real(nbpass))
|
||||
x = sin(ridx*7 + phy)
|
||||
y = cos(ridx*3)
|
||||
|
||||
if (idx .eq. 0) then
|
||||
call genp_move(x, y)
|
||||
else
|
||||
call genp_draw(x, y, col)
|
||||
endif
|
||||
|
||||
enddo
|
||||
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
end program
|
||||
Reference in New Issue
Block a user