Compare commits

..

35 Commits

Author SHA1 Message Date
Tonton Th
0bc55225fc add rotation, need more tests 2026-05-21 16:23:06 +02:00
Tonton Th
3d4fce2ed0 add links... 2026-05-17 19:49:43 +02:00
Tonton Th
ec199da8dd add more bla 2026-05-17 08:07:46 +02:00
Tonton Th
a20725f5ef Oups !!! 2026-05-17 07:51:27 +02:00
Tonton Th
42d066678d some adjustements, but need more work 2026-05-17 07:27:25 +02:00
Tonton Th
ea373fa198 fine tuning 2026-05-17 07:25:02 +02:00
Tonton Th
52e5e99b07 use the render procedure 2026-05-15 11:30:09 +02:00
Tonton Th
086c2af118 add the circles factory 2026-05-14 19:52:23 +02:00
Tonton Th
e060fad764 testing recent changes 2026-05-13 10:02:22 +02:00
Tonton Th
be961b46fc add "make me a circle" thing 2026-05-13 09:59:37 +02:00
Tonton Th
1dd0e71577 add scaling engine 2026-05-13 09:57:35 +02:00
Tonton Th
a0d63856af FIX A POTENTIAL NASTY BUG 2026-05-12 20:43:15 +02:00
Tonton Th
fce8fd4989 add an important molly-guard 2026-05-10 19:07:54 +02:00
Tonton Th
05066538ef add more bla 2026-05-10 01:48:55 +02:00
Tonton Th
0a2598af5b add randomwalk next gen 2026-05-08 23:54:39 +02:00
Tonton Th
d4c3783d72 renaming a subroutine 2026-05-08 08:44:15 +02:00
Tonton Th
a079f026f7 the genp module can now run the renderer 2026-05-07 22:30:30 +02:00
Tonton Th
95a8502d0f nap-time commit 2026-05-05 14:23:20 +02:00
Tonton Th
6747f0e243 repair broken links 2026-05-05 11:30:59 +02:00
Tonton Th
d0914b588a moving docs to docs/ 2026-05-05 11:25:10 +02:00
Tonton Th
aca035c8be this crap need more work 2026-05-05 04:17:46 +02:00
Tonton Th
7feaa0786c more spirals is better 2026-05-05 04:16:42 +02:00
Tonton Th
2c1d5cd196 translate to english 2026-05-05 04:15:38 +02:00
Tonton Th
0e94994155 a small pimping 2026-05-05 04:14:13 +02:00
Tonton Th
cac6e89b00 add a new uselessgraphic: squarmania 2026-05-04 20:01:24 +02:00
Tonton Th
f302cf881a put intermediate files in WS/ 2026-05-03 20:00:19 +02:00
Tonton Th
62012286ff + lissajous plotter 2026-05-01 01:10:00 +02:00
Tonton Th
03b26558ee add a new useless graphic 2026-04-29 08:59:13 +02:00
Tonton Th
4263302e46 add a random start location 2026-04-28 23:00:37 +02:00
Tonton Th
90379c0a0f fix bad formats 2026-04-26 07:56:46 +02:00
Tonton Th
5fb1b809e1 add and use the workspace 2026-04-25 13:12:16 +02:00
Tonton Th
483fa3d13f add mollyguard 2026-04-25 13:11:30 +02:00
Tonton Th
185ee019a8 more doc 2026-04-25 10:35:17 +02:00
Tonton Th
7173a9dc9f remove useless call 2026-04-25 10:34:42 +02:00
Tonton Th
66ecce1c06 better calling 2026-04-25 10:31:09 +02:00
19 changed files with 683 additions and 88 deletions

6
.gitignore vendored
View File

@@ -9,4 +9,10 @@
spirale
starfield
randomwalk
oscilloscope
lissajous
squarmania
testbed
rndwlkng
morecircles

View File

@@ -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 $@
# -----------------------------------------------

View File

@@ -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
View 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
View 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.
![#UselessGraphic : la spirale](../picz/spirale.png)
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
View 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.

View File

@@ -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.
![#UselessGraphic : la spirale](picz/spirale.png)
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
View 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

View File

@@ -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
View 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
View 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
View 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

View File

@@ -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)
@@ -23,14 +27,14 @@ subroutine do_randomwalk(nbre, col)
integer :: idx
real :: px, py, px2, py2
px = 0.0 ; py = 0.0
call genp_move(px, py)
px = 0.0 ; py = 0.0
do idx=1, nbre
px2 = px + rand(0) - 0.50
py2 = py + rand(0) - 0.50
call genp_line(px, py, px2, py2, col)
px = px2 ; py = py2
enddo
end subroutine
! ---------------------------------------------------------
end program

61
rndwlkng.f90 Normal file
View 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
! ---------------------------------------------------------

View File

@@ -1,32 +1,39 @@
!
! 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)
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)
integer, intent(in) :: nbpass
integer idx, col
subroutine do_spirale (nbpass, kdist, krad, phy, col)
integer, intent(in) :: nbpass, col
real, intent(in) :: kdist, krad, phy
integer idx
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
dist = real(idx) * kdist
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
View 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

View File

@@ -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
View 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

View File

@@ -1,27 +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
- call genp_move(x, y)
- call genp_draw(x, y, c)
## Terminator
- call genp_end(0)