Compare commits

..

No commits in common. "0d79c3d7c70d73b132a98dbe987918e37539ed0b" and "595c6901c9a6b922935c4619dea5ba567f677132" have entirely different histories.

10 changed files with 34 additions and 269 deletions

View File

@ -1,6 +1,4 @@
all: voxelize evolvopick pickover julia lorentz
GFOPT = -Wall -Wextra -time -O -Imods/
# ---------------------------------------------
@ -39,6 +37,6 @@ lorentz.pgm: lorentz Makefile
./lorentz $@ > /dev/null
pickover.pgm: pickover Makefile
./pickover $@ > /dev/null
time ./pickover $@ > /dev/null
# ---------------------------------------------

View File

@ -1,4 +1 @@
*.inc
*.err
*.dat
*.log

View File

@ -1,4 +0,0 @@
POVOPT=" -d +q9 +a +W1024 +H768 -v +WT4"

View File

@ -1,25 +1,15 @@
#!/bin/bash
if [ $# -ne 2 ] ; then
echo
echo "need two arguments:"
echo " source dir"
echo " mp4 filename"
exit 1
fi
DDIR="frames/pick3d"
SDIR="$1"
FNAME="$2"
echo "Encoding from " $SDIR " to " $FNAME
TITLE='---{ experimental }---'
echo "Encoding from " $DDIR
ffmpeg -nostdin \
-loglevel warning \
-y -r 25 -f image2 -i $SDIR/%05d.png \
-metadata artist='---{ tTh }---' \
-metadata title="${TITLE}" \
-c:v libx264 -pix_fmt yuv420p \
$FNAME
-loglevel warning \
-y -r 25 -f image2 -i $DDIR/%05d.png \
-metadata artist='---[ tTh ]---' \
-metadata title='---[ experiment ]---' \
-c:v libx264 -pix_fmt yuv420p \
clifford-evolv-0.mp4

View File

@ -60,5 +60,20 @@ program evolvopick
enddo
!-----------------------------------------------------
contains
subroutine interp4dp (ina, inb, out, dpk)
double precision, dimension(4), intent(in) :: ina, inb
double precision, dimension(4), intent(out) :: out
double precision, intent(in) :: dpk
integer :: foo
do foo=1, 4
out(foo) = (ina(foo) * (1.0-dpk)) + (inb(foo) * (dpk))
enddo
end subroutine
end program evolvopick

View File

@ -151,18 +151,8 @@ end subroutine lorentz_0
!-----------------------------------------------------------
! -- some support functions --
!-----------------------------------------------------------
! usage : evolvopick
subroutine interp4dp (ina, inb, out, dpk)
double precision, dimension(4), intent(in) :: ina, inb
double precision, dimension(4), intent(out) :: out
double precision, intent(in) :: dpk
integer :: foo
do foo=1, 4
out(foo) = (ina(foo) * (1.0-dpk)) + (inb(foo) * (dpk))
enddo
end subroutine
!-----------------------------------------------------------
function dist0 (x, y)

View File

@ -1,54 +0,0 @@
#!/bin/bash
echo
source "./common.sh"
make voxelize
if [ $? -ne 0 ] ; then
echo
echo "Make error " $?
exit 1
fi
./voxelize > WS/voxels.dat
./vox2inc.awk < WS/voxels.dat > WS/voxels.inc
TMPNG="/dev/shm/voxvidz.png"
NBIMG=360
for idx in $( seq 0 $(( NBIMG - 1)) )
do
dst=$(printf "frames/voxel/%05d.png" $idx)
delta=$( echo "scale=3 ; ${idx}/360" | bc -l)
echo "Renderbox work on " $dst " tu" $delta
povray -ishowvoxels.pov -K$idx ${POVOPT} \
-O${TMPNG} 2> WS/toto.err
if [ $? -ne 0 ] ; then
echo "ERROR ERROR ERROR ERROR"
tail -15 WS/toto.err
sleep 20
#exit 1
fi
titre='>>> Voxelisation - tTh - avril 2022'
numbers=$(tail -1 WS/camvox.log | \
awk '{printf ">>> %6.3f %6.3f %6.3f", $1, $2, $3}')
echo $numbers
convert ${TMPNG} \
-fill Cyan \
-kerning 1 \
-pointsize 16 \
-font AvantGarde-Book \
-gravity South-West \
-annotate +20+32 "$titre" \
-annotate +20+10 "$numbers" \
$dst
grep 'Parse Time' WS/toto.err
grep 'Trace Time' WS/toto.err
done
./encode.sh frames/voxel/ voxel-1.mp4

View File

@ -1,67 +0,0 @@
/*
* SHOW VOXELS
*
* see also : vox2inc.awk voxelize.f90
*/
#version 3.7;
global_settings {
ambient_light rgb <0.04, 0.04, 0.04>
assumed_gamma 1.0
}
//----------------------------------------------------------------
#include "colors.inc"
#declare VOXEL = object
{
// sphere { 0, 1.18 }
#local D = 1.38;
box { <-D, -D, -D>, <D, D, D> }
}
#include "WS/voxels.inc"
object {
Voxels
texture {
pigment { color White }
finish { phong 0.8 specular 0.8}
}
translate <-Bary_X, -Bary_Y, -Bary_Z>
rotate <clock*2, 0, clock*1.414>
}
//----------------------------------------------------------------
// light_source { <-12, 45, -25> color Gray70 }
light_source { <-52, 5, -38> color Yellow*0.55 }
light_source { < 59, 5, 48> color Gray20 }
light_source { < 3, -59, 8> color Red*0.75 }
light_source { < 8, 61, 3> color Green*0.85 }
#declare NormClock = (clock/360);
#declare ECAM = 88 - 23*NormClock;
#declare XCAM = ECAM * sin(radians(clock));
#declare YCAM = -12;
#declare ZCAM = ECAM * cos(radians(clock));
#declare ACAM = 65 + (27*NormClock);
#if (0 = clock)
#fopen CL "WS/camvox.log" write
#else
#fopen CL "WS/camvox.log" append
#end
#write (CL, NormClock, " ", ECAM, " ", ACAM, "\n")
#fclose CL
camera {
location <XCAM, YCAM, ZCAM>
// look_at <Bary_X, Bary_Y, Bary_Z>
look_at <0, 0, 0>
right x*image_width/image_height
angle ACAM
}
//----------------------------------------------------------------
//----------------------------------------------------------------

View File

@ -1,32 +0,0 @@
#!/usr/bin/awk -f
BEGIN {
maxcount = 0
nbrvox = 0
bx = by = bz = 0.0
print "// generated file, don't touch it bastard !"
print "#declare Voxels = object {"
print "union {"
}
$4 > 145 {
count = $4
value = $5
if (count > maxcount)
{ maxcount = count }
nbrvox++;
bx += $1
by += $2
bz += $3
printf "object { VOXEL scale %f translate <%f, %f, %f> } // %d \n", \
value, $1, $2, $3, count
}
END {
print "} } // done, ", NR, " records read"
print "#declare VoxMaxcount = ", maxcount, ";"
print "#declare NbrVox = ", nbrvox, ";"
print "#declare Bary_X = ", bx/nbrvox, ";"
print "#declare Bary_Y = ", by/nbrvox, ";"
print "#declare Bary_Z = ", bz/nbrvox, ";"
}

View File

@ -1,114 +1,46 @@
!-----------------------------------------------------
! VOXELIZE
! ========
! this is the main program, see also mkvoxvidz.sh
! showvoxels.pov and vox2inc.awk
! this is the main program
!-----------------------------------------------------
program voxelize
use fraktals
integer, parameter :: DIM = 100
integer, parameter :: DIM = 500
integer, dimension(:,:,:), allocatable :: cube
type(t_point3d), dimension(:), allocatable :: points
integer :: errcode, foo
integer :: ix, iy, iz
double precision, dimension(4) :: coefs
double precision :: dval
! XXX foo = (DIM*DIM*DIM) / (1024)
! XXX PRINT *, "memory request for cube (in Kwords) ", foo
foo = (DIM*DIM*DIM) / (1024)
PRINT *, "memory request for cube (in Kwords) ", foo
allocate (cube(DIM,DIM,DIM), stat=errcode)
if (0 .NE. errcode) then
STOP " : NO ENOUGH MEMORY FOR CUBE"
endif
nbr_points = 3100000
nbr_points = 99999
allocate(points(nbr_points), stat=errcode)
if (0 .NE. errcode) then
STOP " : NO ENOUGH MEMORY FOR POINTS"
endif
coefs(1) = 2.23 ; coefs(2) = 0.42
coefs(3) = -0.64 ; coefs(4) = -2.42
coefs(1) = 2.24 ; coefs(2) = 0.43
coefs(3) = -0.65 ; coefs(4) = -2.43
call compute_pickover(points, coefs)
call clear_cube(cube)
! and now, we loop over all the pre-computed
! points of the attractor
!
do foo=1, nbr_points
call fcoor2icoor(points(foo)%x, ix)
call fcoor2icoor(points(foo)%y, iy)
call fcoor2icoor(points(foo)%z, iz)
cube(ix,iy,iz) = cube(ix,iy,iz) + 1
ix = nint(points(foo)%x * dble(DIM))
iy = nint(points(foo)%y * dble(DIM))
iz = nint(points(foo)%z * dble(DIM))
enddo
dval = DBLE(MAXVAL(cube))
write(0, *) "--- cube maximum = ", dval
do foo=1, nbr_points
call fcoor2icoor(points(foo)%x, ix)
call fcoor2icoor(points(foo)%y, iy)
call fcoor2icoor(points(foo)%z, iz)
print *, ix, iy, iz, &
cube(ix,iy,iz), &
DBLE(cube(ix,iy,iz)) / dval
enddo
!-----------------------------------------------------
contains
!-----------------------------------------------------
! or maybe, we can write a function ?
subroutine fcoor2icoor(in, out)
double precision, intent(in) :: in
integer, intent(out) :: out
double precision :: invalue
integer :: outvalue
invalue = (in + 2.0) / 2.0
outvalue = int(invalue * real(DIM/2))
! add molly-guard here
out = outvalue
if (outvalue .LT. 1) out = 1
if (outvalue .GE. DIM) out = DIM-1
end subroutine
!-----------------------------------------------------
subroutine clear_cube(cube)
type(integer), dimension(:,:,:), intent(out) :: cube
integer :: i, j, k
do i=lbound(cube, 1), ubound(cube, 1)
do j=lbound(cube, 2), ubound(cube, 2)
do k=lbound(cube, 3), ubound(cube, 3)
cube(i, j, k) = 0
enddo
enddo
enddo
end subroutine
!-----------------------------------------------------
subroutine spit_cube_as_union(fname, datas, notused)
character(*) :: fname
type(integer), dimension(:,:,:), intent(in) :: datas
integer :: notused
integer :: fd, errcode, foo
open (newunit=fd, file='WS/k-pick.txt', &
status='unknown', position='append', &
action='write', iostat=errcode)
if (0 .NE. errcode) then
STOP ' : SPITUNION : FAIL OPEN OUTPUT FILE'
endif
close(fd)
end subroutine
!-----------------------------------------------------
end program voxelize
!-----------------------------------------------------