Compare commits
No commits in common. "d0ac316652da142f8f42008577faf9c640a14e9d" and "17e5de3ecbc0c3b3cded2fc1944f58af07d20a0a" have entirely different histories.
d0ac316652
...
17e5de3ecb
1
GrafAnim/.gitignore
vendored
1
GrafAnim/.gitignore
vendored
@ -1,6 +1,5 @@
|
||||
|
||||
essai
|
||||
doubledice
|
||||
|
||||
*.scratch
|
||||
*.tga
|
||||
|
@ -7,9 +7,6 @@ GFOPT = -Wall -Wextra -g -time
|
||||
essai: essai.f90 usegenplot.o Makefile
|
||||
gfortran $(GFOPT) $< usegenplot.o -o $@
|
||||
|
||||
doubledice: doubledice.f90 usegenplot.o Makefile
|
||||
gfortran $(GFOPT) $< usegenplot.o -o $@
|
||||
|
||||
usegenplot.o: usegenplot.f90 Makefile
|
||||
gfortran $(GFOPT) -c $<
|
||||
|
||||
|
@ -1,9 +0,0 @@
|
||||
program doubledice
|
||||
use usegenplot
|
||||
implicit none
|
||||
|
||||
call init_genplot("essai.genplot")
|
||||
|
||||
call end_genplot("OK boomer")
|
||||
|
||||
end program
|
@ -4,43 +4,38 @@ program essai
|
||||
|
||||
integer :: foo, bar
|
||||
integer :: nbarg
|
||||
integer :: numframe = 0
|
||||
character(len=256) :: arg
|
||||
integer :: numframe = 1
|
||||
character(len=32) :: arg
|
||||
|
||||
! write(0, *) "------------ essai graf anim ---------------"
|
||||
|
||||
nbarg = IARGC()
|
||||
if (nbarg .GT. 0) then
|
||||
call GETARG(1, arg)
|
||||
! write (0, '(A40, A5)') "argument = ", arg
|
||||
write (0, '(A40, A5)') "argument = ", arg
|
||||
read (arg, *) numframe
|
||||
endif
|
||||
|
||||
write(0, '(A20, I5)') "frame number =", numframe
|
||||
write(0, '(A40, I5)') "frame number =", numframe
|
||||
|
||||
call init_genplot("essai.genplot")
|
||||
call do_frame(7)
|
||||
! call do_frame(7)
|
||||
|
||||
call gplt_setcol(2)
|
||||
|
||||
bar = (numframe * 20) - 120
|
||||
do foo=20, 620, 50
|
||||
bar = (numframe * 20) - 160
|
||||
do foo=20, 620, 40
|
||||
call gplt_line(foo, 20, bar, 460)
|
||||
call gplt_line(bar, 20, foo, 460)
|
||||
enddo
|
||||
|
||||
call end_genplot("done for today")
|
||||
|
||||
contains !------------------------------------------
|
||||
|
||||
subroutine do_frame(color)
|
||||
integer, intent(in) :: color
|
||||
integer :: savecol
|
||||
|
||||
savecol = gplt_getcol()
|
||||
call gplt_setcol(color)
|
||||
call gplt_rect(0, 0, 640, 480)
|
||||
call gplt_setcol(savecol)
|
||||
call gplt_line( 0, 0, 640, 0)
|
||||
call gplt_line( 0, 480, 640, 480)
|
||||
call gplt_line( 0, 0, 0, 480)
|
||||
call gplt_line(640, 0, 640, 480)
|
||||
|
||||
end subroutine
|
||||
|
||||
|
@ -9,7 +9,7 @@ do
|
||||
./essai $foo > a.scratch
|
||||
fname=$(printf "F/%04d.tga" $foo)
|
||||
echo $fname
|
||||
genplot2 -s 640x480 a.scratch $fname
|
||||
genplot2 a.scratch $fname
|
||||
|
||||
done
|
||||
|
||||
|
@ -1,9 +1,6 @@
|
||||
module usegenplot
|
||||
|
||||
implicit none
|
||||
|
||||
integer, private :: color = 4
|
||||
logical, private :: initialised = .FALSE.
|
||||
contains
|
||||
|
||||
! -------------------------------------------------------------------
|
||||
@ -11,62 +8,23 @@ module usegenplot
|
||||
subroutine init_genplot(filename)
|
||||
|
||||
character(*), intent(in) :: filename
|
||||
|
||||
write(0, *) '--> init genplot "', filename, '"'
|
||||
initialised = .TRUE.
|
||||
color = 4
|
||||
|
||||
end subroutine
|
||||
|
||||
subroutine end_genplot(message)
|
||||
|
||||
character(*), intent(in) :: message
|
||||
write(0, *) '--> end genplot "', message, '"'
|
||||
initialised = .FALSE.
|
||||
|
||||
end subroutine
|
||||
|
||||
! -------------------------------------------------------------------
|
||||
|
||||
subroutine do_initialise_once(motif)
|
||||
|
||||
character(*), intent(in) :: motif
|
||||
|
||||
write(0, *) '--> do initialise once "', motif, '", flag is ', initialised
|
||||
|
||||
call init_genplot('a.scratch')
|
||||
|
||||
end subroutine
|
||||
|
||||
! -------------------------------------------------------------------
|
||||
|
||||
subroutine gplt_setcol(col)
|
||||
integer, intent(in) :: col
|
||||
color = col
|
||||
end subroutine
|
||||
function gplt_getcol()
|
||||
integer gplt_getcol
|
||||
gplt_getcol = color
|
||||
end function
|
||||
! -------------------------------------------------------------------
|
||||
|
||||
subroutine gplt_move(x, y)
|
||||
integer, intent(in) :: x, y
|
||||
|
||||
if (.NOT. initialised) then
|
||||
call do_initialise_once('in gplt_move')
|
||||
endif
|
||||
|
||||
print *, x, y, 0
|
||||
integer, intent(in) :: x, y
|
||||
print *, x, y, 0
|
||||
end subroutine
|
||||
|
||||
! -------------------------------------------------------------------
|
||||
|
||||
subroutine gplt_draw(x, y)
|
||||
integer, intent(in) :: x, y
|
||||
if (.NOT. initialised) then
|
||||
call do_initialise_once('in gplt_draw')
|
||||
endif
|
||||
print *, x, y, color
|
||||
integer, intent(in) :: x, y
|
||||
print *, x, y, 2
|
||||
end subroutine
|
||||
|
||||
! -------------------------------------------------------------------
|
||||
@ -78,19 +36,11 @@ subroutine gplt_line(x1, y1, x2, y2)
|
||||
end subroutine
|
||||
|
||||
! -------------------------------------------------------------------
|
||||
|
||||
subroutine gplt_rect(x1, y1, x2, y2)
|
||||
integer, intent(in) :: x1, y1, x2, y2
|
||||
|
||||
call gplt_move(x1, y1)
|
||||
call gplt_draw(x2, y1)
|
||||
call gplt_draw(x2, y2)
|
||||
call gplt_draw(x1, y2)
|
||||
call gplt_draw(x1, y1)
|
||||
integer, intent(in) :: x1, y1, x2, y2! -------------------------------------------------------------------
|
||||
|
||||
end subroutine
|
||||
|
||||
! -------------------------------------------------------------------
|
||||
! -------------------------------------------------------------------
|
||||
|
||||
end module
|
||||
|
2
GravityField/.gitignore
vendored
2
GravityField/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
|
||||
essai
|
@ -1,8 +0,0 @@
|
||||
#
|
||||
# Fortraneries by tTh - Gravity Field
|
||||
#
|
||||
|
||||
GFOPT = -Wall -Wextra -g -time
|
||||
|
||||
essai: essai.f90 Makefile
|
||||
gfortran $(GFOPT) $< -o $@
|
@ -1,5 +0,0 @@
|
||||
# Gravity Field
|
||||
|
||||
Some crude experiments to make fancy picture of a useless gravaity field.
|
||||
|
||||
Expect bug party.
|
@ -1,62 +0,0 @@
|
||||
program essai
|
||||
implicit none
|
||||
|
||||
integer :: ix, iy
|
||||
real :: fx, fy
|
||||
real :: foo, bar, maxi, mini
|
||||
|
||||
maxi = 0.0
|
||||
mini = 9e9
|
||||
|
||||
do ix=1, 2000
|
||||
fx = real(ix)
|
||||
do iy=1, 2000
|
||||
fy = real(iy)
|
||||
|
||||
foo = rdist(fx, fy, 222.22, 765.432)
|
||||
bar = gravity(foo, 1337.0)
|
||||
|
||||
maxi = max(maxi, bar)
|
||||
mini = min(mini, bar)
|
||||
|
||||
enddo
|
||||
enddo
|
||||
|
||||
print *, "dist : ", mini, maxi
|
||||
|
||||
contains !------------------------------------------
|
||||
|
||||
function gravity(distance, masse)
|
||||
real, intent(in) :: distance, masse
|
||||
real :: gravity
|
||||
real :: computed
|
||||
|
||||
if (distance .LT. 0.010) then
|
||||
computed = 0.0
|
||||
else
|
||||
computed = masse / (distance ** 2)
|
||||
endif
|
||||
|
||||
gravity = computed
|
||||
|
||||
end function
|
||||
|
||||
!------------------------------------------
|
||||
|
||||
function rdist(ax, ay, bx, by)
|
||||
real, intent(in) :: ax, ay, bx, by
|
||||
real :: rdist
|
||||
real :: rx, ry
|
||||
|
||||
rx = real(ax-bx)
|
||||
ry = real(ay-by)
|
||||
|
||||
rdist = sqrt( (rx*rx) + (ry*ry) )
|
||||
|
||||
end function
|
||||
|
||||
|
||||
!------------------------------------------
|
||||
!------------------------------------------
|
||||
|
||||
end program
|
@ -1,7 +1,7 @@
|
||||
# Fortraneries
|
||||
|
||||
Le Fortran moderne, c'est quand même assez cool, alors autant diffuser
|
||||
mes gruikeries. Pour l'édification des masses...
|
||||
mes gruikeries.
|
||||
|
||||
J'ai découvert le Fortran moderne lors de mon reclufinement
|
||||
de Janvier 2022, et j'ai bien aimé. Bon, contrairement à la
|
||||
@ -13,8 +13,7 @@ l'existence des _pointeurs_ compense largement.
|
||||
- [SoundBrotching](SoundBrotching/) : faire gémir vos tympans
|
||||
- [BloubWorld](BloubWorld/) : la vie des particules
|
||||
- [Fraktalism](Fraktalism/) : du chaos dans les pixels
|
||||
- [RandomStuff](RandomStuff/) : on a tous droit à notre jardin secret
|
||||
- [GrafAnim](GrafAnim/) : Ah, enfin de la gif89a en vue !
|
||||
- [RandomStuff](RandomStuff) : on a tous droit à notre jardin secret
|
||||
|
||||
## hotline
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user