Compare commits
32 Commits
185ee019a8
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0bc55225fc | ||
|
|
3d4fce2ed0 | ||
|
|
ec199da8dd | ||
|
|
a20725f5ef | ||
|
|
42d066678d | ||
|
|
ea373fa198 | ||
|
|
52e5e99b07 | ||
|
|
086c2af118 | ||
|
|
e060fad764 | ||
|
|
be961b46fc | ||
|
|
1dd0e71577 | ||
|
|
a0d63856af | ||
|
|
fce8fd4989 | ||
|
|
05066538ef | ||
|
|
0a2598af5b | ||
|
|
d4c3783d72 | ||
|
|
a079f026f7 | ||
|
|
95a8502d0f | ||
|
|
6747f0e243 | ||
|
|
d0914b588a | ||
|
|
aca035c8be | ||
|
|
7feaa0786c | ||
|
|
2c1d5cd196 | ||
|
|
0e94994155 | ||
|
|
cac6e89b00 | ||
|
|
f302cf881a | ||
|
|
62012286ff | ||
|
|
03b26558ee | ||
|
|
4263302e46 | ||
|
|
90379c0a0f | ||
|
|
5fb1b809e1 | ||
|
|
483fa3d13f |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -9,4 +9,10 @@
|
||||
spirale
|
||||
starfield
|
||||
randomwalk
|
||||
oscilloscope
|
||||
lissajous
|
||||
squarmania
|
||||
testbed
|
||||
rndwlkng
|
||||
morecircles
|
||||
|
||||
|
||||
73
Makefile
73
Makefile
@@ -1,27 +1,92 @@
|
||||
#
|
||||
|
||||
all: spirale.png
|
||||
all: testbed
|
||||
|
||||
# -----------------------------------------------
|
||||
|
||||
genplotting.o: genplotting.f90 Makefile
|
||||
gfortran -Wall -c $<
|
||||
|
||||
genp_tests.o: genp_tests.f90 genplotting.o Makefile
|
||||
gfortran -Wall -c $<
|
||||
|
||||
testbed: testbed.f90 Makefile genp_tests.o genplotting.o
|
||||
gfortran -Wall $< genplotting.o genp_tests.o -o $@
|
||||
|
||||
# -----------------------------------------------
|
||||
|
||||
rndwlkng: rndwlkng.f90 Makefile genplotting.o
|
||||
gfortran -Wall $< genplotting.o -o $@
|
||||
|
||||
rndwlkng.png: rndwlkng Makefile
|
||||
./rndwlkng
|
||||
convert rndwlkng.tga rndwlkng.png
|
||||
|
||||
# -----------------------------------------------
|
||||
|
||||
morecircles: morecircles.f90 Makefile genplotting.o
|
||||
gfortran -Wall $< genplotting.o -o $@
|
||||
|
||||
morecircles.png: morecircles Makefile
|
||||
./morecircles
|
||||
convert morecircles.tga morecircles.png
|
||||
|
||||
# -----------------------------------------------
|
||||
|
||||
starfield: starfield.f90 Makefile genplotting.o
|
||||
gfortran -Wall $< genplotting.o -o $@
|
||||
|
||||
starfield.png: starfield Makefile
|
||||
./starfield
|
||||
convert -verbose WS/a.tga $@
|
||||
|
||||
# -----------------------------------------------
|
||||
|
||||
randomwalk: randomwalk.f90 Makefile genplotting.o
|
||||
gfortran -Wall $< genplotting.o -o $@
|
||||
|
||||
randomwalk.png: randomwalk Makefile
|
||||
./randomwalk
|
||||
genplot2 -s 512x512 WS/randomwalk.scratch WS/a.tga
|
||||
convert WS/a.tga $@
|
||||
|
||||
# -----------------------------------------------
|
||||
|
||||
oscilloscope: oscilloscope.f90 Makefile genplotting.o
|
||||
gfortran -Wall $< genplotting.o -o $@
|
||||
|
||||
oscilloscope.png: oscilloscope Makefile
|
||||
./oscilloscope
|
||||
genplot2 -s 512x512 WS/oscilloscope.scratch WS/a.tga
|
||||
convert WS/a.tga $@
|
||||
|
||||
# -----------------------------------------------
|
||||
|
||||
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 $@
|
||||
./spirale
|
||||
convert WS/a.tga $@
|
||||
|
||||
# -----------------------------------------------
|
||||
|
||||
lissajous: lissajous.f90 Makefile genplotting.o
|
||||
gfortran -Wall $< genplotting.o -o $@
|
||||
|
||||
lissajous.png: lissajous Makefile
|
||||
./lissajous
|
||||
genplot2 -s 512x512 WS/lissajous.scratch WS/a.tga
|
||||
convert WS/a.tga $@
|
||||
|
||||
# -----------------------------------------------
|
||||
|
||||
squarmania: squarmania.f90 Makefile genplotting.o
|
||||
gfortran -Wall $< genplotting.o -o $@
|
||||
|
||||
squarmania.png: squarmania Makefile
|
||||
./squarmania
|
||||
genplot2 -s 512x512 WS/squarmania.scratch WS/a.tga
|
||||
convert WS/a.tga $@
|
||||
|
||||
# -----------------------------------------------
|
||||
|
||||
11
README.md
11
README.md
@@ -2,11 +2,16 @@
|
||||
|
||||
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 ?*
|
||||
morceaux de C parce que *why not ?* L'idée générale c'est d'utiliser
|
||||
de la basse technologie (traduction hasardeuse de **lowtech**) pour
|
||||
servir la noble cause de la
|
||||
[techno-futilité](https://wiki.interhacker.space/index.php?title=Techno-futilit%C3%A9).
|
||||
|
||||
Un peu de lecture : [utilisation](usage.md) et [exemples](exemples.md).
|
||||
Un peu de lecture : [license](LICENSE), [utilisation](usage.md) et
|
||||
[exemples](exemples.md).
|
||||
|
||||
Vous pouvez suivre le croisimot [#UselessGraphic](https://mastodon.tetaneutral.net/tags/uselessgraphic)
|
||||
Vous pouvez suivre le croisimot
|
||||
[#UselessGraphic](https://pleroma.interhacker.space/tag/uselessgraphic)
|
||||
dans le grand Ternet sauvage. Pour me contacter, il faut utiliser les
|
||||
[méthodes](https://www.tetalab.org/fr/contact) habituelles du Tetalab.
|
||||
|
||||
|
||||
3
WS/README.md
Normal file
3
WS/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# This is the work space.
|
||||
|
||||
Used to store work files, like `a.scratch` plotting directives.
|
||||
24
docs/exemples.md
Normal file
24
docs/exemples.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Genplotting exemples
|
||||
|
||||
## Spiral
|
||||
|
||||
Source code: [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.
|
||||
|
||||

|
||||
|
||||
This was my first testbed for this new *disruptive* technology, but
|
||||
there was so many variations of spirales, and i'm thinking about
|
||||
a powerfull spiral generator. *Stay tuned, film at 11*.
|
||||
|
||||
## Dessins numériques
|
||||
|
||||
By the way, I'm using all that *futilo-technology* for trying to
|
||||
make some
|
||||
[numeric pictures](http://maison.tth.netlib.re/dessins/numerique.html)
|
||||
(aka #UselessGraphic). I try to use various mathematic fundations, and
|
||||
I hack and divert and modify and ignore all that for just make
|
||||
[UselessGraphic](https://mastodon.tetaneutral.net/tags/uselessgraphic).
|
||||
*Feel free to share and enjoy*.
|
||||
|
||||
53
docs/usage.md
Normal file
53
docs/usage.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# Usage
|
||||
|
||||
The genplotting library use, as a backend, an external
|
||||
[software](https://git.tetalab.org/tTh/libtthimage/src/branch/master/Tools/genplot2.c)
|
||||
who can be installed with the [libtthimage](https://git.tetalab.org/tTh/libtthimage) and convert scratchfiles to
|
||||
[Targa](https://en.wikipedia.org/wiki/Truevision_TGA) image file.
|
||||
|
||||
For drawing an *useless graphic*, you have to follow three steps:
|
||||
initialize, use and terminating.
|
||||
You can look at some [examples](exemples.md) and at a
|
||||
[full page](http://maison.tth.netlib.re/dessins/numerique.html)
|
||||
off UselessGraphics.
|
||||
|
||||
## Initialize
|
||||
|
||||
Call the subroutine `genp_init` with two parameters.
|
||||
The first is an integer and must be 0. In the futur, it may be used for
|
||||
setting some predefined configurations.
|
||||
|
||||
The second is the filename for recording the plottings instructions,
|
||||
I'm using the `.scratch` extension for naming this file.
|
||||
And if this filename is an empty string, *stdout* will be used, so
|
||||
you can pipe the data for post-processing purpose.
|
||||
**Be warned:** if you use this option, don't write anything to the
|
||||
unit 6 **!**
|
||||
|
||||
## Use it
|
||||
|
||||
- `real xa, ya, xb, yb`
|
||||
- `integer color`
|
||||
- `call genp_move(xa, ya)`
|
||||
- `call genp_draw(xa, ya, color)`
|
||||
- `call genp_line(xa, ya, xb, yb, color)`
|
||||
|
||||
## Terminator
|
||||
|
||||
- `call genp_end(0)`
|
||||
This procedure end the current plotting, add some *bells* to the *WIP*,
|
||||
and close the output file, if an output file was specified.
|
||||
|
||||
## Rendering
|
||||
|
||||
- `subroutine genp_do_render(srcfile, tgafile, xsize, ysize)`
|
||||
|
||||
After doing all that useless computing graphics, you can call
|
||||
the render, only if you have given a filename to `genp_init`.
|
||||
The render engine that I use can only write Targa file, but
|
||||
I'm going to add `PNG` to it output in a near futur.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
21
exemples.md
21
exemples.md
@@ -1,21 +0,0 @@
|
||||
# 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.
|
||||
|
||||

|
||||
|
||||
This was my first testbed for this new *disruptive* technology, but
|
||||
there was so many variations of spirales, and i'm thinking about
|
||||
a powerfull spiral generator. *Stay tuned, film at 11*.
|
||||
|
||||
## Dessins numériques
|
||||
|
||||
Et donc, j'utilise toute cette futilo-technologie pour essayer de
|
||||
faire des
|
||||
[dessins numériques](http://maison.tth.netlib.re/dessins/numerique.html)
|
||||
en expliquant ma démarche de création et d'autres vagues pensées qui
|
||||
me passent par la tête.
|
||||
41
genp_tests.f90
Normal file
41
genp_tests.f90
Normal file
@@ -0,0 +1,41 @@
|
||||
!
|
||||
! MODULE FOR TESTING THE GENPLOTTING MODULE
|
||||
!
|
||||
! this crapware is released by tTh under the
|
||||
! DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
!
|
||||
! new Sun May 17 11:21:39 AM UTC 2026
|
||||
|
||||
module genp_tests
|
||||
use genplotting
|
||||
implicit none
|
||||
contains
|
||||
! ---------------------------------------------------------
|
||||
subroutine genp_test_rotation()
|
||||
|
||||
real :: mat(3, 3)
|
||||
real :: pta(3), ptb(3)
|
||||
integer :: pass, i, j
|
||||
|
||||
write(0, '("*** TEST ROTATION ***")' )
|
||||
do pass=1, 90
|
||||
call genp_set_rotation (real(pass)*0.10)
|
||||
write(0, *) " * the matrix was : "
|
||||
call genp_get_rot_matrix(mat)
|
||||
do i=1, 3
|
||||
do j=1, 3
|
||||
write (0, '(" ", F8.5)', advance='no') mat(i,j)
|
||||
end do
|
||||
write(0, *)
|
||||
end do
|
||||
|
||||
call genp_move(0.0, 0.0)
|
||||
pta(1) = 11.0 ; pta(2) = 0.0 ; pta(3) = 0.0
|
||||
ptb = matmul(mat, pta)
|
||||
write(0, '(" got XY: ", F8.5, " ", F8.5)') ptb(1), ptb(2)
|
||||
call genp_draw(ptb(1), ptb(2), 1+mod(pass, 7))
|
||||
end do ! pass
|
||||
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
end module
|
||||
180
genplotting.f90
180
genplotting.f90
@@ -11,15 +11,30 @@ module genplotting
|
||||
real :: xoffset, yoffset, xscale, yscale
|
||||
private :: xoffset, yoffset, xscale, yscale
|
||||
|
||||
integer :: outunit
|
||||
real :: rotation, rotmatrix(3,3)
|
||||
private :: rotation, rotmatrix, compute_rot_matrix
|
||||
private :: print_rot_matrix
|
||||
|
||||
integer :: outunit = 6
|
||||
private :: outunit
|
||||
|
||||
contains
|
||||
! ---------------------------------------------------------
|
||||
! the first parameter _must_ be 0.
|
||||
! the second can be
|
||||
! - the name of a file for recording plot instructions
|
||||
! or
|
||||
! - an empty string for send plot command to stdout
|
||||
!
|
||||
subroutine genp_init (foo, fname)
|
||||
integer, intent(in) :: foo
|
||||
character (len=*), intent(in) :: fname
|
||||
|
||||
IF (FOO .NE. 0) THEN
|
||||
WRITE(0, '("FOO .NE. 0")')
|
||||
CALL EXIT(1)
|
||||
END IF
|
||||
|
||||
outunit = 6 ! stdout
|
||||
if (len(fname) .gt. 0) then
|
||||
write (0, '("genplot init opening : ", A)') fname
|
||||
@@ -29,7 +44,10 @@ subroutine genp_init (foo, fname)
|
||||
xmin = 9e9 ; xmax = -9e9
|
||||
ymin = 9e9 ; ymax = -9e9
|
||||
xoffset = 0.0 ; yoffset = 0.0
|
||||
xscale = 0.0 ; yscale = 0.0
|
||||
xscale = 1.0 ; yscale = 1.0
|
||||
|
||||
rotation = 0.0
|
||||
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
subroutine genp_set_offset(ox, oy)
|
||||
@@ -41,10 +59,71 @@ subroutine genp_get_offset(ox, oy)
|
||||
ox = xoffset ; oy = yoffset
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
! new Tue May 12 06:51:57 PM UTC 2026
|
||||
subroutine genp_set_scale(sx, sy)
|
||||
real, intent(in) :: sx, sy
|
||||
xscale = sx ; yscale = sy
|
||||
end subroutine
|
||||
subroutine genp_get_scale(sx, sy)
|
||||
real, intent(out) :: sx, sy
|
||||
sx = xscale ; sy = yscale
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
! this is a private procedure, don't call it from your prog
|
||||
subroutine compute_rot_matrix(angle)
|
||||
real, intent(in) :: angle
|
||||
write (0, '("compute rot matrix for", F8.5, " radians")') &
|
||||
angle
|
||||
rotmatrix (1, 1) = cos(angle)
|
||||
rotmatrix (1, 2) = sin(angle)
|
||||
rotmatrix (1, 3) = 0.0
|
||||
|
||||
rotmatrix (2, 1) = -sin(angle)
|
||||
rotmatrix (2, 2) = cos(angle)
|
||||
rotmatrix (2, 3) = 0.0
|
||||
|
||||
rotmatrix (3, 1) = 0.0
|
||||
rotmatrix (3, 2) = 0.0
|
||||
rotmatrix (3, 3) = 1.0
|
||||
|
||||
end subroutine
|
||||
! -----------------
|
||||
! we have computed some fancy numbers
|
||||
! and we want to see them !
|
||||
subroutine print_rot_matrix(fd)
|
||||
integer, intent(in) :: fd
|
||||
|
||||
integer :: i, j
|
||||
do i=1, 3
|
||||
do j=1, 3
|
||||
write (fd, '(" ", F8.5)', advance='no') rotmatrix(i,j)
|
||||
end do
|
||||
write(fd, *)
|
||||
end do
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
subroutine genp_set_rotation(angle)
|
||||
real, intent(in) :: angle
|
||||
rotation = angle
|
||||
! compute the matrix here !
|
||||
call compute_rot_matrix(angle)
|
||||
! call print_rot_matrix(0)
|
||||
end subroutine
|
||||
|
||||
real function genp_get_rotation()
|
||||
genp_get_rotation = rotation
|
||||
end function
|
||||
|
||||
subroutine genp_get_rot_matrix (dst)
|
||||
real, intent(out) :: dst(3, 3)
|
||||
dst = rotmatrix
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
subroutine genp_move (px, py)
|
||||
real, intent(in) :: px, py
|
||||
real :: lx, ly
|
||||
lx = px + xoffset ; ly = py + yoffset
|
||||
lx = (px*xscale) + xoffset
|
||||
ly = (py*yscale) + yoffset
|
||||
write (outunit, '(2F12.5, I5)') lx, ly, -1
|
||||
if (lx .lt. xmin) xmin = lx
|
||||
if (lx .gt. xmax) xmax = lx
|
||||
@@ -56,7 +135,8 @@ subroutine genp_draw (px, py, color)
|
||||
real, intent(in) :: px, py
|
||||
integer, intent(in) :: color
|
||||
real :: lx, ly
|
||||
lx = px + xoffset ; ly = py + yoffset
|
||||
lx = (px*xscale) + xoffset
|
||||
ly = (py*yscale) + yoffset
|
||||
write (outunit, '(2F12.5, I5)') lx, ly, color
|
||||
if (lx .lt. xmin) xmin = lx
|
||||
if (lx .gt. xmax) xmax = lx
|
||||
@@ -71,18 +151,54 @@ subroutine genp_line(xa, ya, xb, yb, color)
|
||||
call genp_draw(xb, yb, color)
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
subroutine genp_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 genp_circle(radius, steps, color)
|
||||
real, intent(in) :: radius
|
||||
integer, intent(in) :: steps, color
|
||||
|
||||
integer :: idx
|
||||
real :: fk, ang, x, y
|
||||
logical :: firstdot
|
||||
|
||||
if (steps .LT.3 ) then
|
||||
write(0, '("circle: steps ", I3, " bad value")') steps
|
||||
return
|
||||
endif
|
||||
|
||||
firstdot = .TRUE.
|
||||
do idx=0, steps
|
||||
fk = real(idx) / real(steps)
|
||||
ang = 6.283185307 * fk
|
||||
! write(0, '(I5, " -> ", 2F10.5)') idx, fk, ang
|
||||
x = radius * cos(ang) ; y = radius * sin(ang)
|
||||
if (firstdot) then
|
||||
call genp_move(x, y) ; firstdot = .FALSE.
|
||||
else
|
||||
call genp_draw(x, y, color)
|
||||
endif
|
||||
enddo
|
||||
|
||||
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 (0, '("------------- genp_end -------------")')
|
||||
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
|
||||
@@ -91,6 +207,46 @@ subroutine genp_end (foo)
|
||||
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
! /!\ warning /!\
|
||||
! this procedure is highly experimental, don't use it
|
||||
! for any real (or critical) work, but it was fine for
|
||||
! playing around with the #UselessGraphic concept.
|
||||
|
||||
subroutine genp_do_render(srcfile, tgafile, xsize, ysize)
|
||||
character (len=*), intent(in) :: srcfile, tgafile
|
||||
integer, intent(in) :: xsize, ysize
|
||||
|
||||
character (len=1664) :: cmdline
|
||||
character (len=20) :: dima, dimb
|
||||
integer :: i, j, errcode
|
||||
|
||||
if (6 .EQ. outunit) then
|
||||
write(0, '(" Sorry, I can not do that, Dave !")')
|
||||
stop " >>> FATAL ERROR"
|
||||
endif
|
||||
|
||||
write(0, '("--- genp do_render ---")')
|
||||
write(0, '(" srcfile: ", A)') srcfile
|
||||
write(0, '(" tgafile: ", A)') tgafile
|
||||
write(0, '(" picsize: ", 2I5)') xsize, ysize
|
||||
|
||||
write(dima, '(I5, "x", I5)') xsize, ysize
|
||||
! write(0, '("dima [",A, "]")') dima
|
||||
dimb = "" ; j = 1
|
||||
do i=1, len(dima)
|
||||
if (dima(i:i) .NE. ' ') then
|
||||
dimb(j:j) = dima(i:i)
|
||||
j = j +1
|
||||
endif
|
||||
enddo
|
||||
! write(0, '("[",A, "]")') trim(dimb)
|
||||
write(cmdline, '("genplot2 -s ", A, " ", A, " ", A)') &
|
||||
trim(dimb), srcfile, tgafile
|
||||
write(0, '(A)') trim(cmdline)
|
||||
call execute_command_line(cmdline, exitstat=errcode)
|
||||
write(0, '("errcode was :", I6)') errcode
|
||||
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
|
||||
end module genplotting
|
||||
|
||||
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, 20
|
||||
phase = real(foo) * 0.314159
|
||||
c = 3 + mod(foo, 2)
|
||||
call do_lissajous (400, 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 + 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
|
||||
28
morecircles.f90
Normal file
28
morecircles.f90
Normal file
@@ -0,0 +1,28 @@
|
||||
!
|
||||
! YOU LIKE CIRCLES ? TAKE IT SISTA !
|
||||
!
|
||||
! this crapware is released by tTh under the
|
||||
! DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
!
|
||||
|
||||
program morecircles
|
||||
use genplotting
|
||||
implicit none
|
||||
integer idx
|
||||
real fdx, xp, yp, scx, scy
|
||||
call genp_init(0, "WS/morecircles.scratch")
|
||||
scx = 0.6 ; scy = 2.3
|
||||
do idx=5, 60
|
||||
fdx = real(idx)
|
||||
xp = 3.5 * cos((fdx/14.0)-0.7)
|
||||
yp = 3.5 * sin((fdx/10.0)+0.3)
|
||||
call genp_set_offset(xp, yp)
|
||||
call genp_set_scale(scx, scy)
|
||||
call genp_circle(fdx, 60, 1+mod(idx, 3))
|
||||
scx = scx + 0.0185
|
||||
scy = scy - 0.0129
|
||||
enddo
|
||||
call genp_end(0)
|
||||
call genp_do_render("WS/morecircles.scratch", "morecircles.tga", &
|
||||
512, 512)
|
||||
end program
|
||||
69
oscilloscope.f90
Normal file
69
oscilloscope.f90
Normal file
@@ -0,0 +1,69 @@
|
||||
!
|
||||
! OSCILLOSCOPE EXPERIMENT
|
||||
!
|
||||
! this crapware is released by tTh under the
|
||||
! DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
!
|
||||
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) = 24.86
|
||||
frequences(2) = 29.77
|
||||
frequences(3) = 37.56
|
||||
frequences(4) = 49.3
|
||||
|
||||
call do_oscilloscope(frequences, 2)
|
||||
|
||||
call genp_end (0)
|
||||
contains
|
||||
! ---------------------------------------------------------
|
||||
real function compute_a_value(clk, freq, phase)
|
||||
real, intent(in) :: clk, freq, phase
|
||||
real :: v, f
|
||||
f = freq*(clk+phase)
|
||||
v = sin(f) + (0.3 * sin(3*f)) + (0.1 * sin(5*f))
|
||||
compute_a_value = v
|
||||
end function
|
||||
! ---------------------------------------------------------
|
||||
subroutine plot_a_trace(freq, phy, nbsteps, ypos, col)
|
||||
real, intent(in) :: freq, phy, ypos
|
||||
integer, intent(in) :: nbsteps, col
|
||||
|
||||
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 + compute_a_value (rstep, freq, phy)
|
||||
if (firstdot) then
|
||||
call genp_move(px, py) ; firstdot = .false.
|
||||
else
|
||||
call genp_draw(px, py, col)
|
||||
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, 120, 6.66, col)
|
||||
call plot_a_trace(freqs(2), 1.0, 120, 3.33, col)
|
||||
call plot_a_trace(freqs(3), 2.6, 120, -3.33, col)
|
||||
call plot_a_trace(freqs(4), 3.1, 120, -6.66, col)
|
||||
call genp_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, 'randomwalk.scratch')
|
||||
do foo=1, 51
|
||||
col = 2 + mod(foo, 4)
|
||||
call do_randomwalk(42, col)
|
||||
call genp_init (0, 'WS/randomwalk.scratch')
|
||||
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)
|
||||
@@ -30,6 +34,7 @@ subroutine do_randomwalk(nbre, col)
|
||||
call genp_line(px, py, px2, py2, col)
|
||||
px = px2 ; py = py2
|
||||
enddo
|
||||
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
end program
|
||||
|
||||
61
rndwlkng.f90
Normal file
61
rndwlkng.f90
Normal file
@@ -0,0 +1,61 @@
|
||||
!
|
||||
! Random Walk Next Generation
|
||||
! new Fri May 8 06:53:02 AM UTC 2026
|
||||
!
|
||||
! this crapware is released by tTh under the
|
||||
! DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
!
|
||||
! ---------------------------------------------------------
|
||||
program rndwlkng
|
||||
use genplotting
|
||||
implicit none
|
||||
|
||||
type walker
|
||||
real :: xloc, yloc ! where I am ?
|
||||
real :: heading ! direction in degrees
|
||||
real :: powa ! correlated to nothing
|
||||
end type walker
|
||||
|
||||
type (walker) drunky
|
||||
integer pass
|
||||
|
||||
call srand(time())
|
||||
|
||||
call genp_init(0, "WS/rndwlkng.scratch")
|
||||
|
||||
do pass=1, 73
|
||||
drunky%xloc = 5555 * (rand(0) - 0.50)
|
||||
drunky%yloc = 5555 * (rand(0) - 0.50)
|
||||
drunky%heading = 360 * rand(0)
|
||||
drunky%powa = 6.00
|
||||
call move_the_walker(drunky, 700, mod(pass, 6)+1)
|
||||
end do
|
||||
|
||||
call genp_end(0)
|
||||
call genp_do_render("WS/rndwlkng.scratch", "rndwlkng.tga", 512, 512)
|
||||
|
||||
contains
|
||||
! ---------------------------------------------------------
|
||||
subroutine move_the_walker(bob, nbmove, col)
|
||||
type (walker), intent(inout) :: bob
|
||||
integer, intent(in) :: nbmove, col
|
||||
|
||||
integer :: idx
|
||||
real :: rad, mv, dx, dy
|
||||
|
||||
call genp_move(bob%xloc, bob%yloc)
|
||||
do idx=1, nbmove
|
||||
rad = ( 3.141592654 * bob%heading ) / 180.0
|
||||
mv = 1.555 + (bob%powa * rand(0))
|
||||
dx = mv * sin(rad)
|
||||
dy = mv * cos(rad)
|
||||
bob%xloc = bob%xloc + dx
|
||||
bob%yloc = bob%yloc + dy
|
||||
bob%heading = bob%heading + 42.42 * (rand(0) - 0.50000)
|
||||
call genp_draw(bob%xloc, bob%yloc, col)
|
||||
enddo
|
||||
|
||||
end subroutine
|
||||
! ---------------------------------------------------------
|
||||
end program
|
||||
! ---------------------------------------------------------
|
||||
20
spirale.f90
20
spirale.f90
@@ -1,23 +1,30 @@
|
||||
!
|
||||
! SPIRALING...
|
||||
! new Thu Apr 23 04:27:03 PM UTC 2026
|
||||
!
|
||||
|
||||
! this crapware is released under the
|
||||
! DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
!
|
||||
program spirale
|
||||
use genplotting
|
||||
implicit none
|
||||
|
||||
character(*), parameter :: scratch = "WS/spirale.scratch"
|
||||
|
||||
write (0, '(A)') "----[ genplotting spirale ]----"
|
||||
|
||||
call genp_init (0, 's.scratch')
|
||||
call do_spirale (1337, 0.51, 0.0666, 0.7)
|
||||
call genp_init (0, scratch)
|
||||
call do_spirale (1337, 0.51, 0.0666, 0.7, 5)
|
||||
call do_spirale (1337, 0.42, 0.0333, 0.7, 6)
|
||||
call genp_end (0)
|
||||
call genp_do_render(scratch, "WS/a.tga", 512, 512)
|
||||
|
||||
contains
|
||||
! ---------------------------------------------------------
|
||||
subroutine do_spirale (nbpass, kdist, krad, phy)
|
||||
integer, intent(in) :: nbpass
|
||||
subroutine do_spirale (nbpass, kdist, krad, phy, col)
|
||||
integer, intent(in) :: nbpass, col
|
||||
real, intent(in) :: kdist, krad, phy
|
||||
integer idx, col
|
||||
integer idx
|
||||
real rad, px, py, dist
|
||||
|
||||
px = 0.0 ; py = 0.0
|
||||
@@ -27,7 +34,6 @@ subroutine do_spirale (nbpass, kdist, krad, phy)
|
||||
rad = (real(idx) * krad) + phy
|
||||
px = dist * sin(rad)
|
||||
py = dist * cos(rad)
|
||||
col = 3
|
||||
call genp_draw (px, py, col)
|
||||
enddo
|
||||
end subroutine
|
||||
|
||||
50
squarmania.f90
Normal file
50
squarmania.f90
Normal file
@@ -0,0 +1,50 @@
|
||||
!
|
||||
! SQUARMANIA
|
||||
! new Thu Apr 23 04:27:03 PM UTC 2026
|
||||
!
|
||||
! this crapware is released by tTh under the
|
||||
! DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
!
|
||||
program squarmania
|
||||
use genplotting
|
||||
implicit none
|
||||
|
||||
write (0, '(A)') "----[ genplotting squarmania ]----"
|
||||
|
||||
call genp_init (0, 'WS/squarmania.scratch')
|
||||
call do_squarmania (40, 0.934)
|
||||
call genp_end (0)
|
||||
|
||||
contains
|
||||
! ---------------------------------------------------------
|
||||
subroutine do_squarmania (nbr, k0)
|
||||
integer, intent(in) :: nbr
|
||||
real, intent(in) :: k0
|
||||
|
||||
integer :: idx
|
||||
real :: xa, xb, xc, xd, ya, yb, yc, yd
|
||||
real :: va, vb, vc, vd, wa, wb, wc, wd, k2
|
||||
|
||||
k2 = 1.0 - k0
|
||||
xa = 1 ; ya = 1 ; xb = 1 ; yb = -1
|
||||
xc = -1 ; yc = -1 ; xd = -1 ; yd = 1
|
||||
|
||||
do idx=1, nbr
|
||||
call genp_move(xa, ya)
|
||||
call genp_draw(xb, yb, 1) ; call genp_draw(xc, yc, 1)
|
||||
call genp_draw(xd, yd, 2) ; call genp_draw(xa, ya, 2)
|
||||
|
||||
va = k0*xa + k2*xb ; wa = k0*ya + k2*yb
|
||||
vb = k0*xb + k2*xc ; wb = k0*yb + k2*yc
|
||||
vc = k0*xc + k2*xd ; wc = k0*yc + k2*yd
|
||||
vd = k0*xd + k2*xa ; wd = k0*yd + k2*ya
|
||||
|
||||
xa = va ; xb = vb ; xc = vc ; xd = vd
|
||||
ya = wa ; yb = wb ; yc = wc ; yd = wd
|
||||
|
||||
enddo
|
||||
|
||||
end subroutine
|
||||
|
||||
! ---------------------------------------------------------
|
||||
end program
|
||||
@@ -1,24 +1,35 @@
|
||||
!
|
||||
! BUILD A STAR FIELD
|
||||
|
||||
! this crapware is released by tTh under the
|
||||
! DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
!
|
||||
program starfield
|
||||
use genplotting
|
||||
implicit none
|
||||
|
||||
character(*), parameter :: scratch = "WS/starfield.scratch"
|
||||
|
||||
write (0, '(A)') "----[ genplotting starfield ]----"
|
||||
call genp_init (0, 'starfield.scratch')
|
||||
call do_starfield (451)
|
||||
call genp_init (0, scratch)
|
||||
call do_starfield (300)
|
||||
call genp_end (0)
|
||||
call genp_do_render(scratch, "WS/a.tga", 512, 512)
|
||||
|
||||
contains
|
||||
! ---------------------------------------------------------
|
||||
subroutine plot_a_star(at_x, at_y, sz, color)
|
||||
real, intent(in) :: at_x, at_y, sz
|
||||
integer, intent(in) :: color
|
||||
|
||||
integer :: idx
|
||||
real :: rad, xv, yv
|
||||
write(0, '("plot a star ", 2F8.3)') at_x, at_y
|
||||
|
||||
write(0, '("plot a star at ", 2F8.3)') at_x, at_y
|
||||
call genp_set_offset(at_x, at_y)
|
||||
do idx=0, 360, 36
|
||||
rad = 0.042 + (real(idx) * (3.14159 / 180))
|
||||
! convert index to radians
|
||||
rad = real(idx) * (3.14159 / 180)
|
||||
xv = sz * sin(rad) ; yv = sz * cos(rad)
|
||||
call genp_move(0.0, 0.0)
|
||||
call genp_draw(xv, yv, color)
|
||||
@@ -27,12 +38,13 @@ end subroutine
|
||||
! ---------------------------------------------------------
|
||||
subroutine do_starfield (nbstar)
|
||||
integer, intent(in) :: nbstar
|
||||
|
||||
integer idx, color
|
||||
real px, py, sz
|
||||
do idx=1, nbstar
|
||||
px = (rand(0) * 10.00) - 5.00
|
||||
py = (rand(0) * 10.00) - 5.00
|
||||
sz = (rand(0) * 0.16) + 0.16
|
||||
sz = (rand(0) * 0.30) + 0.12
|
||||
color = 1 + mod(idx, 7)
|
||||
call plot_a_star(px, py, sz, color)
|
||||
end do
|
||||
|
||||
18
testbed.f90
Normal file
18
testbed.f90
Normal file
@@ -0,0 +1,18 @@
|
||||
!
|
||||
! TESTBED FOR GENPLOTTING90
|
||||
!
|
||||
! this crapware is released by tTh under the
|
||||
! DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
|
||||
!
|
||||
|
||||
program testbed
|
||||
use genplotting
|
||||
use genp_tests
|
||||
implicit none
|
||||
|
||||
call genp_init(0, "foo.scratch")
|
||||
call genp_test_rotation()
|
||||
! call genp_plot_axes(5.1)
|
||||
call genp_end(0)
|
||||
|
||||
end program
|
||||
30
usage.md
30
usage.md
@@ -1,30 +0,0 @@
|
||||
# Usage
|
||||
|
||||
The genplotting library use, as a backend, an external
|
||||
[software](https://git.tetalab.org/tTh/libtthimage/src/branch/master/Tools/genplot2.c)
|
||||
who can be installed with the [libtthimage](https://git.tetalab.org/tTh/libtthimage) and convert scratchfiles to
|
||||
[Targa](https://en.wikipedia.org/wiki/Truevision_TGA) image file.
|
||||
|
||||
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
|
||||
|
||||
- real xa, ya, xb, yb
|
||||
- integer color
|
||||
- call genp_move(xa, ya)
|
||||
- call genp_draw(xa, ya, color)
|
||||
- call genp_line(xa, ya, xb, yb, color)
|
||||
|
||||
## Terminator
|
||||
|
||||
- call genp_end(0)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user