the start of a new adventure
This commit is contained in:
10
.gitignore
vendored
Normal file
10
.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
*.mod
|
||||||
|
*.o
|
||||||
|
*.scratch
|
||||||
|
*.tga
|
||||||
|
|
||||||
|
*.png
|
||||||
|
!picz/*.png
|
||||||
|
|
||||||
|
spirale
|
||||||
|
|
||||||
19
Makefile
Normal file
19
Makefile
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
|
||||||
|
all: spirale.png
|
||||||
|
|
||||||
|
# -----------------------------------------------
|
||||||
|
|
||||||
|
genplotting.o: genplotting.f90 Makefile
|
||||||
|
gfortran -Wall -c $<
|
||||||
|
|
||||||
|
# -----------------------------------------------
|
||||||
|
|
||||||
|
spirale: spirale.f90 Makefile genplotting.o
|
||||||
|
gfortran -Wall $< genplotting.o -o $@
|
||||||
|
|
||||||
|
spirale.png: spirale Makefile
|
||||||
|
./spirale > s.scratch
|
||||||
|
genplot2 -s 512x512 s.scratch a.tga
|
||||||
|
convert a.tga $@
|
||||||
|
|
||||||
|
# -----------------------------------------------
|
||||||
10
README.md
10
README.md
@@ -1,3 +1,11 @@
|
|||||||
# GenPlotting90
|
# GenPlotting90
|
||||||
|
|
||||||
Diverses tentatives de dessins inutiles avec du Fortran moderne. Croisimot #UselessGraphic dans le grabd Ternet sauvage.
|
Voici quelques tentatives de dessins inutiles réalisés avec du
|
||||||
|
[Fortran moderne](https://fortran-lang.org/fr/learn/), et quelques
|
||||||
|
morceaux de C parce que *why not ?*
|
||||||
|
|
||||||
|
Un peu de lecture : [utilisation](usage.md) et [exemples](exemples.md).
|
||||||
|
|
||||||
|
Vous pouvez suivre le croisimot [#UselessGraphic](https://mastodon.tetaneutral.net/tags/uselessgraphic)
|
||||||
|
dans le grand Ternet sauvage. Pour me contacter, il faut utiliser les
|
||||||
|
[méthodes](
|
||||||
|
|||||||
10
exemples.md
Normal file
10
exemples.md
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
# Genplotting exemples
|
||||||
|
|
||||||
|
## Spiral
|
||||||
|
|
||||||
|
Code source : [spirale.f90](spirale.f90) / if you change the parameter
|
||||||
|
in the call to `do_spirale`, you can see some nice variations on the
|
||||||
|
spiraling thing.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
76
genplotting.f90
Normal file
76
genplotting.f90
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
! SPIRALING...
|
||||||
|
! new Thu Apr 23 01:13.37 PM UTC 2026
|
||||||
|
!
|
||||||
|
module genplotting
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
real :: xmin, xmax, ymin, ymax
|
||||||
|
private :: xmin, xmax, ymin, ymax
|
||||||
|
|
||||||
|
real :: xoffset, yoffset, xscale, yscale
|
||||||
|
private :: xoffset, yoffset, xscale, yscale
|
||||||
|
|
||||||
|
integer :: outunit
|
||||||
|
private :: outunit
|
||||||
|
|
||||||
|
contains
|
||||||
|
! ---------------------------------------------------------
|
||||||
|
subroutine genp_init (foo, fname)
|
||||||
|
integer, intent(in) :: foo
|
||||||
|
character (len=*), intent(in) :: fname
|
||||||
|
|
||||||
|
outunit = 6 ! stdout
|
||||||
|
if (len(fname) .gt. 0) then
|
||||||
|
write (0, '("genplot init opening : ", A)') fname
|
||||||
|
open(newunit=outunit,file=fname)
|
||||||
|
endif
|
||||||
|
|
||||||
|
xmin = 9e9 ; xmax = -9e9
|
||||||
|
ymin = 9e9 ; ymax = -9e9
|
||||||
|
xoffset = 0.0 ; yoffset = 0.0
|
||||||
|
xscale = 0.0 ; yscale = 0.0
|
||||||
|
end subroutine
|
||||||
|
! ---------------------------------------------------------
|
||||||
|
subroutine genp_move (px, py)
|
||||||
|
real, intent(in) :: px, py
|
||||||
|
write (outunit, '(2F12.5, I5)') px, py, -1
|
||||||
|
if (px .lt. xmin) xmin = px
|
||||||
|
if (px .gt. xmax) xmax = px
|
||||||
|
if (py .lt. ymin) ymin = py
|
||||||
|
if (py .gt. ymax) ymax = py
|
||||||
|
end subroutine
|
||||||
|
! ---------------------------------------------------------
|
||||||
|
subroutine genp_draw (px, py, color)
|
||||||
|
real, intent(in) :: px, py
|
||||||
|
integer, intent(in) :: color
|
||||||
|
write (outunit, '(2F12.5, I5)') px, py, color
|
||||||
|
if (px .lt. xmin) xmin = px
|
||||||
|
if (px .gt. xmax) xmax = px
|
||||||
|
if (py .lt. ymin) ymin = py
|
||||||
|
if (py .gt. ymax) ymax = py
|
||||||
|
end subroutine
|
||||||
|
! ---------------------------------------------------------
|
||||||
|
! ---------------------------------------------------------
|
||||||
|
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 (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
|
||||||
|
close (outunit)
|
||||||
|
|
||||||
|
if (6 .ne. outunit) then
|
||||||
|
write (0, '("genp_end on ", I6, " is ", I6)') outunit, foo
|
||||||
|
endif
|
||||||
|
|
||||||
|
end subroutine
|
||||||
|
! ---------------------------------------------------------
|
||||||
|
! ---------------------------------------------------------
|
||||||
|
|
||||||
|
end module genplotting
|
||||||
BIN
picz/spirale.png
Normal file
BIN
picz/spirale.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.3 KiB |
34
spirale.f90
Normal file
34
spirale.f90
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
! SPIRALING...
|
||||||
|
! new Thu Apr 23 04:27:03 PM UTC 2026
|
||||||
|
!
|
||||||
|
|
||||||
|
program spirale
|
||||||
|
use genplotting
|
||||||
|
implicit none
|
||||||
|
|
||||||
|
write (0, '(A)') "----[ genplotting spirale ]----"
|
||||||
|
|
||||||
|
call genp_init (0, 's.scratch')
|
||||||
|
call do_spirale (1337)
|
||||||
|
call genp_end (0)
|
||||||
|
|
||||||
|
contains
|
||||||
|
! ---------------------------------------------------------
|
||||||
|
subroutine do_spirale (nbpass)
|
||||||
|
integer, intent(in) :: nbpass
|
||||||
|
integer idx, col
|
||||||
|
real rad, px, py, dist
|
||||||
|
|
||||||
|
px = 0.0 ; py = 0.0
|
||||||
|
call genp_move (px, py)
|
||||||
|
do idx=1, nbpass
|
||||||
|
dist = real(idx) * 0.51
|
||||||
|
rad = real(idx) * 0.0666
|
||||||
|
px = dist * sin(rad)
|
||||||
|
py = dist * cos(rad)
|
||||||
|
col = 3
|
||||||
|
call genp_draw (px, py, col)
|
||||||
|
enddo
|
||||||
|
end subroutine
|
||||||
|
! ---------------------------------------------------------
|
||||||
|
end program
|
||||||
22
usage.md
Normal file
22
usage.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# Usage
|
||||||
|
|
||||||
|
Three steps : initialize, use and terminating.
|
||||||
|
|
||||||
|
## Initialize
|
||||||
|
|
||||||
|
Call the subroutine `genp_init` with two parameters.
|
||||||
|
The first is an integer and must be 0.
|
||||||
|
The second is the filename for recording the plottings instructions,
|
||||||
|
if this filename is an empty string, *stdout* will be used.
|
||||||
|
|
||||||
|
## Use it
|
||||||
|
|
||||||
|
- call genp_move(x, y)
|
||||||
|
- call genp_draw(x, y, c)
|
||||||
|
|
||||||
|
## Terminator
|
||||||
|
|
||||||
|
- call genp_end(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user