trigofest is running

This commit is contained in:
tTh 2023-02-11 15:31:21 +01:00
parent 8223cb8e77
commit 37efbc3404
4 changed files with 170 additions and 3 deletions

6
GrafAnim/.gitignore vendored
View File

@ -1,8 +1,14 @@
essai
doubledice
doublegauss
trigofest
*.scratch
*.genplot
*.tga
F/*.tga
*.gif
*.pnm
*.pgm

View File

@ -2,14 +2,33 @@
# Fortraneries by tTh - Graf Anim
#
GFOPT = -Wall -Wextra -g -time
GFOPT = -Wall -Wextra -g -time -I../Modules
# ---- programmes
essai: essai.f90 usegenplot.o Makefile
gfortran $(GFOPT) $< usegenplot.o -o $@
doubledice: doubledice.f90 usegenplot.o Makefile
gfortran $(GFOPT) $< usegenplot.o -o $@
doubledice: doubledice.f90 Makefile \
utils_ga.o usegenplot.o
gfortran $(GFOPT) $< usegenplot.o utils_ga.o -o $@
doublegauss: doublegauss.f90 Makefile utils_ga.o
gfortran $(GFOPT) $< ../Modules/pixrgb.o utils_ga.o -o $@
trigofest: trigofest.f90 Makefile vue3axes.o utils_ga.o
gfortran $(GFOPT) $< ../Modules/pixrgb.o ../Modules/spitpgm.o \
utils_ga.o -o $@
# ---- modules locaux
usegenplot.o: usegenplot.f90 Makefile
gfortran $(GFOPT) -c $<
utils_ga.o: utils_ga.f90 Makefile
gfortran $(GFOPT) -c $<
vue3axes.o: vue3axes.f90 Makefile
gfortran $(GFOPT) -c $<

View File

@ -4,3 +4,19 @@ Quelques essais approximatifs pour faire des graphiques inutiles,
dans une démarche mettant en avant la techno-futilité, une notion
bien définie par le collectif Interhack.
Actuellement, certains des logiciels que vous voyez ici utilisent un backend
graphique brassé à la maison et nommé `genplot2`. Hélas, celui-ci est
un peu foireux sur les tracés de ligne...
## trigofest
Distorsions de la courbe de Lissajous.
## doubledice
Ou comment dessiner des gaussiennes.
## vue3axes
Un module assez spécialisé

126
GrafAnim/trigofest.f90 Normal file
View File

@ -0,0 +1,126 @@
program trigofest
!-
! ces divagations me viennent de superbes codes en Processing
! allez visiter https://bleuje.com/tutorial1/ c'est d'la balle
!-
use spitpgm ! in ../Modules
implicit none
integer, dimension(:,:), allocatable :: picz
integer :: W, H
integer :: errcode
integer :: loop
character(200) :: filename
real :: blouber
!-------------------------------------------------------------
W = 512 ; H = 342
allocate(picz(W,H), stat=errcode)
blouber = 0.01
do loop=0, 359
call spirale(picz, blouber, loop*9)
blouber = blouber * 1.0259
write (filename, "(a, i5.5, a)") "F/spi/", loop, ".pgm"
call spit_as_pgm_8(picz, trim(filename))
print *, loop, blouber
enddo
STOP ': WORLD FINISHED'
contains !------------------------------------------
!-------------------------------------------------------------
! Lowlevel functions
! ------------------
subroutine plot_a_dot(pic, ix, iy, val)
implicit none
integer, dimension(:,:), intent(out) :: pic
integer, intent(in) :: ix, iy, val
integer :: lx, ly, ux, uy
lx = lbound(pic, 1) ; ux = ubound(pic, 1)
ly = lbound(pic, 2) ; uy = ubound(pic, 2)
! write(0, *) 'plot dot ' , ix, iy
! write(0, *) ' X size ' , lx, ux
! write(0, *) ' Y size ' , ly, uy
if ( ix .LT. lx ) then
! write(0, *) 'UNDER, IX', ix, 'LX', lx
! STOP ': UNDER ZERO'
return
endif
if ( ix .GT. ux ) then
! write(0, *) 'OVER, IX', ix, 'UX', ux
! STOP ': OVER9000 '
return
endif
if ( iy .LT. ly ) then
! write(0, *) 'UNDER, IY', iy, 'LY', ly
! STOP ': UNDER ZERO'
return
endif
if ( iy .GT. uy ) then
! write(0, *) 'OVER, IY', iy, 'UY', uy
! STOP ': OVER9000 '
return
endif
if ( (val .LT. 0) .OR. (val .GT. 255) ) then
write(0, *) 'VAL = ', val
STOP ': BAD PIXEL VALUE'
endif
pic(ix, iy) = val
end subroutine
!-------------------------------------------------------------
! La premirere spirale
! --------------------
subroutine spirale(pic, inirad, param)
implicit none
integer, dimension(:,:), intent(out) :: pic
real, intent(in) :: inirad
integer, intent(in) :: param
real :: angle, radius, rx, ry
real :: kx, ky
integer :: foo, ix, iy
pic = 0 ! clear the picture
radius = inirad
do foo=0, 360*15
angle = real(foo) * 0.01745329252
! rx = radius * sin(angle) * 1.21
kx = sin(angle*2)
rx = radius * kx
! ry = radius * cos(angle)
ky = cos(angle) + (0.5*cos(angle*4.0))
ry = radius * ky
radius = radius + 0.025
ix = int(rx) + W/2
iy = int(ry) + H/2
! print *, foo, ix, iy
call plot_a_dot(picz, ix, iy, 255-mod(foo+param, 255));
enddo
end subroutine
!-------------------------------------------------------------
!-------------------------------------------------------------
end program