Compare commits

..

7 Commits

Author SHA1 Message Date
Tonton Th
bdeef4344e Hello Anthropic ! 2026-06-03 09:19:59 +02:00
Tonton Th
a27ee8fbdc welcome here, vibecoding 2026-06-02 14:38:57 +02:00
Tonton Th
e80bdd0ad5 progress on transformation matrix 2026-06-02 14:37:14 +02:00
Tonton Th
1fc04c90ec this is a nice patch, bro 2026-05-23 00:43:33 +02:00
Tonton Th
fa334cd7de mute a debug message 2026-05-22 04:30:46 +02:00
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
8 changed files with 142 additions and 24 deletions

1
AGENTS.md Normal file
View File

@@ -0,0 +1 @@
GO FUCK YOURSELF

5
CLAUDE.md Normal file
View File

@@ -0,0 +1,5 @@
# STFU !
And bring me a bottle of Casanis !

View File

@@ -7,8 +7,11 @@ all: testbed
genplotting.o: genplotting.f90 Makefile genplotting.o: genplotting.f90 Makefile
gfortran -Wall -c $< gfortran -Wall -c $<
testbed: testbed.f90 Makefile genplotting.o genp_tests.o: genp_tests.f90 genplotting.o Makefile
gfortran -Wall $< genplotting.o -o $@ gfortran -Wall -c $<
testbed: testbed.f90 Makefile genp_tests.o genplotting.o
gfortran -Wall $< genplotting.o genp_tests.o -o $@
# ----------------------------------------------- # -----------------------------------------------

View File

@@ -7,6 +7,9 @@ who can be installed with the [libtthimage](https://git.tetalab.org/tTh/libtthim
For drawing an *useless graphic*, you have to follow three steps: For drawing an *useless graphic*, you have to follow three steps:
initialize, use and terminating. 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 ## Initialize

38
genp_tests.f90 Normal file
View File

@@ -0,0 +1,38 @@
!
! 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)
! display the rotation matrix
do i=1, 3
do j=1, 3
write (0, '(" ", F8.5)', advance='no') mat(i,j)
end do
write(0, *)
end do
end do ! pass
end subroutine
! ---------------------------------------------------------
! ---------------------------------------------------------
end module

View File

@@ -11,8 +11,9 @@ module genplotting
real :: xoffset, yoffset, xscale, yscale real :: xoffset, yoffset, xscale, yscale
private :: xoffset, yoffset, xscale, yscale private :: xoffset, yoffset, xscale, yscale
real :: rotation real :: rotation, rotmatrix(3,3)
private :: rotation private :: rotation, rotmatrix, compute_rot_matrix
private :: print_rot_matrix
integer :: outunit = 6 integer :: outunit = 6
private :: outunit private :: outunit
@@ -21,7 +22,7 @@ contains
! --------------------------------------------------------- ! ---------------------------------------------------------
! the first parameter _must_ be 0. ! the first parameter _must_ be 0.
! the second can be ! the second can be
! - the name of a file for recoding plot instructions ! - the name of a file for recording plot instructions
! or ! or
! - an empty string for send plot command to stdout ! - an empty string for send plot command to stdout
! !
@@ -44,6 +45,7 @@ subroutine genp_init (foo, fname)
ymin = 9e9 ; ymax = -9e9 ymin = 9e9 ; ymax = -9e9
xoffset = 0.0 ; yoffset = 0.0 xoffset = 0.0 ; yoffset = 0.0
xscale = 1.0 ; yscale = 1.0 xscale = 1.0 ; yscale = 1.0
rotation = 0.0 rotation = 0.0
end subroutine end subroutine
@@ -67,9 +69,64 @@ subroutine genp_get_scale(sx, sy)
sx = xscale ; sy = yscale sx = xscale ; sy = yscale
end subroutine 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) subroutine genp_move (px, py)
real, intent(in) :: px, py real, intent(in) :: px, py
real :: lx, ly real :: lx, ly
real :: pt(3)
! ====== insert rotation here ?
pt(1) = px ; pt(2) = py ; pt(3) = 0.0
lx = (px*xscale) + xoffset lx = (px*xscale) + xoffset
ly = (py*yscale) + yoffset ly = (py*yscale) + yoffset
write (outunit, '(2F12.5, I5)') lx, ly, -1 write (outunit, '(2F12.5, I5)') lx, ly, -1
@@ -83,6 +140,9 @@ subroutine genp_draw (px, py, color)
real, intent(in) :: px, py real, intent(in) :: px, py
integer, intent(in) :: color integer, intent(in) :: color
real :: lx, ly real :: lx, ly
! ====== insert rotation here ?
lx = (px*xscale) + xoffset lx = (px*xscale) + xoffset
ly = (py*yscale) + yoffset ly = (py*yscale) + yoffset
write (outunit, '(2F12.5, I5)') lx, ly, color write (outunit, '(2F12.5, I5)') lx, ly, color
@@ -135,13 +195,26 @@ subroutine genp_circle(radius, steps, color)
end subroutine end subroutine
! --------------------------------------------------------- ! ---------------------------------------------------------
! draw a square centered on 0,0
subroutine genp_square (amp, color)
real, intent(in) :: amp
integer, intent(in) :: color
real :: ha
ha = amp / 2.0
call genp_move(-ha, -ha)
call genp_draw(-ha, ha, color)
call genp_draw( ha, ha, color)
call genp_draw( ha, -ha, color)
end subroutine
! ---------------------------------------------------------
subroutine genp_end (foo) subroutine genp_end (foo)
integer, intent(in) :: foo integer, intent(in) :: foo
write (0, '("--- genp_end ---")') write (0, '("------------- genp_end -------------")')
write (0, '("minmax X ", 2F18.5)') xmin, xmax write (0, '("minmax X ", 2F18.5)') xmin, xmax
write (0, '("minmax Y ", 2F18.5)') ymin, ymax write (0, '("minmax Y ", 2F18.5)') ymin, ymax
! XXX NASTY BUG HERE !
write (outunit, '(2F18.5, I6)') xmin*1.05, ymin*1.05, -1 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)') 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, ymax*1.05, 0

View File

@@ -8,13 +8,14 @@ program starfield
use genplotting use genplotting
implicit none implicit none
character(*), parameter :: scratch = "WS/starfield.scratch" character(*), parameter :: projname = "starfield"
character(*), parameter :: scratch = "WS/"//projname//".scratch"
write (0, '(A)') "----[ genplotting starfield ]----" write (0, '(A)') "----[ genplotting starfield ]----"
call genp_init (0, scratch) call genp_init (0, scratch)
call do_starfield (300) call do_starfield (300)
call genp_end (0) call genp_end (0)
call genp_do_render(scratch, "WS/a.tga", 512, 512) call genp_do_render(scratch, "WS/"//projname//".tga", 512, 512)
contains contains
! --------------------------------------------------------- ! ---------------------------------------------------------
@@ -25,7 +26,7 @@ subroutine plot_a_star(at_x, at_y, sz, color)
integer :: idx integer :: idx
real :: rad, xv, yv real :: rad, xv, yv
write(0, '("plot a star at ", 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) call genp_set_offset(at_x, at_y)
do idx=0, 360, 36 do idx=0, 360, 36
! convert index to radians ! convert index to radians

View File

@@ -1,23 +1,17 @@
!
! TESTBED FOR GENPLOTTING90
!
! this crapware is released by tTh under the
! DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
!
program testbed program testbed
use genplotting use genplotting
use genp_tests
implicit none implicit none
integer idx
real fdx, xp, yp, scx, scy
call genp_init(0, "foo.scratch") call genp_init(0, "foo.scratch")
scx = 0.8 ; scy = 1.5 call genp_test_rotation()
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.0075
scy = scy - 0.0075
enddo
call genp_end(0) call genp_end(0)
call genp_do_render("foo.scratch", "foo.tga", 512, 512)
end program end program