Compare commits
4 Commits
595c6901c9
...
0d79c3d7c7
Author | SHA1 | Date | |
---|---|---|---|
|
0d79c3d7c7 | ||
|
15cb51c6bc | ||
|
c45658e181 | ||
|
913452bc81 |
@ -1,4 +1,6 @@
|
|||||||
|
|
||||||
|
all: voxelize evolvopick pickover julia lorentz
|
||||||
|
|
||||||
GFOPT = -Wall -Wextra -time -O -Imods/
|
GFOPT = -Wall -Wextra -time -O -Imods/
|
||||||
|
|
||||||
# ---------------------------------------------
|
# ---------------------------------------------
|
||||||
@ -37,6 +39,6 @@ lorentz.pgm: lorentz Makefile
|
|||||||
./lorentz $@ > /dev/null
|
./lorentz $@ > /dev/null
|
||||||
|
|
||||||
pickover.pgm: pickover Makefile
|
pickover.pgm: pickover Makefile
|
||||||
time ./pickover $@ > /dev/null
|
./pickover $@ > /dev/null
|
||||||
|
|
||||||
# ---------------------------------------------
|
# ---------------------------------------------
|
||||||
|
3
Fraktalism/WS/.gitignore
vendored
3
Fraktalism/WS/.gitignore
vendored
@ -1 +1,4 @@
|
|||||||
*.inc
|
*.inc
|
||||||
|
*.err
|
||||||
|
*.dat
|
||||||
|
*.log
|
||||||
|
4
Fraktalism/common.sh
Normal file
4
Fraktalism/common.sh
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
|
||||||
|
|
||||||
|
POVOPT=" -d +q9 +a +W1024 +H768 -v +WT4"
|
||||||
|
|
@ -1,15 +1,25 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
DDIR="frames/pick3d"
|
if [ $# -ne 2 ] ; then
|
||||||
|
echo
|
||||||
|
echo "need two arguments:"
|
||||||
|
echo " source dir"
|
||||||
|
echo " mp4 filename"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Encoding from " $DDIR
|
SDIR="$1"
|
||||||
|
FNAME="$2"
|
||||||
|
echo "Encoding from " $SDIR " to " $FNAME
|
||||||
|
|
||||||
|
TITLE='---{ experimental }---'
|
||||||
|
|
||||||
ffmpeg -nostdin \
|
ffmpeg -nostdin \
|
||||||
-loglevel warning \
|
-loglevel warning \
|
||||||
-y -r 25 -f image2 -i $DDIR/%05d.png \
|
-y -r 25 -f image2 -i $SDIR/%05d.png \
|
||||||
-metadata artist='---[ tTh ]---' \
|
-metadata artist='---{ tTh }---' \
|
||||||
-metadata title='---[ experiment ]---' \
|
-metadata title="${TITLE}" \
|
||||||
-c:v libx264 -pix_fmt yuv420p \
|
-c:v libx264 -pix_fmt yuv420p \
|
||||||
clifford-evolv-0.mp4
|
$FNAME
|
||||||
|
|
||||||
|
|
||||||
|
@ -60,20 +60,5 @@ program evolvopick
|
|||||||
enddo
|
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
|
end program evolvopick
|
||||||
|
@ -151,8 +151,18 @@ end subroutine lorentz_0
|
|||||||
!-----------------------------------------------------------
|
!-----------------------------------------------------------
|
||||||
! -- some support functions --
|
! -- 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)
|
function dist0 (x, y)
|
||||||
|
54
Fraktalism/mkvoxvidz.sh
Executable file
54
Fraktalism/mkvoxvidz.sh
Executable file
@ -0,0 +1,54 @@
|
|||||||
|
#!/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
|
67
Fraktalism/showvoxels.pov
Normal file
67
Fraktalism/showvoxels.pov
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* 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
|
||||||
|
}
|
||||||
|
|
||||||
|
//----------------------------------------------------------------
|
||||||
|
//----------------------------------------------------------------
|
32
Fraktalism/vox2inc.awk
Executable file
32
Fraktalism/vox2inc.awk
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/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, ";"
|
||||||
|
}
|
@ -1,46 +1,114 @@
|
|||||||
!-----------------------------------------------------
|
!-----------------------------------------------------
|
||||||
! VOXELIZE
|
! VOXELIZE
|
||||||
! ========
|
! ========
|
||||||
! this is the main program
|
! this is the main program, see also mkvoxvidz.sh
|
||||||
|
! showvoxels.pov and vox2inc.awk
|
||||||
!-----------------------------------------------------
|
!-----------------------------------------------------
|
||||||
program voxelize
|
program voxelize
|
||||||
use fraktals
|
use fraktals
|
||||||
|
|
||||||
integer, parameter :: DIM = 500
|
integer, parameter :: DIM = 100
|
||||||
integer, dimension(:,:,:), allocatable :: cube
|
integer, dimension(:,:,:), allocatable :: cube
|
||||||
type(t_point3d), dimension(:), allocatable :: points
|
type(t_point3d), dimension(:), allocatable :: points
|
||||||
integer :: errcode, foo
|
integer :: errcode, foo
|
||||||
integer :: ix, iy, iz
|
integer :: ix, iy, iz
|
||||||
double precision, dimension(4) :: coefs
|
double precision, dimension(4) :: coefs
|
||||||
|
double precision :: dval
|
||||||
|
|
||||||
foo = (DIM*DIM*DIM) / (1024)
|
! XXX foo = (DIM*DIM*DIM) / (1024)
|
||||||
PRINT *, "memory request for cube (in Kwords) ", foo
|
! XXX PRINT *, "memory request for cube (in Kwords) ", foo
|
||||||
|
|
||||||
allocate (cube(DIM,DIM,DIM), stat=errcode)
|
allocate (cube(DIM,DIM,DIM), stat=errcode)
|
||||||
if (0 .NE. errcode) then
|
if (0 .NE. errcode) then
|
||||||
STOP " : NO ENOUGH MEMORY FOR CUBE"
|
STOP " : NO ENOUGH MEMORY FOR CUBE"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
nbr_points = 99999
|
nbr_points = 3100000
|
||||||
allocate(points(nbr_points), stat=errcode)
|
allocate(points(nbr_points), stat=errcode)
|
||||||
if (0 .NE. errcode) then
|
if (0 .NE. errcode) then
|
||||||
STOP " : NO ENOUGH MEMORY FOR POINTS"
|
STOP " : NO ENOUGH MEMORY FOR POINTS"
|
||||||
endif
|
endif
|
||||||
|
|
||||||
coefs(1) = 2.24 ; coefs(2) = 0.43
|
coefs(1) = 2.23 ; coefs(2) = 0.42
|
||||||
coefs(3) = -0.65 ; coefs(4) = -2.43
|
coefs(3) = -0.64 ; coefs(4) = -2.42
|
||||||
call compute_pickover(points, coefs)
|
call compute_pickover(points, coefs)
|
||||||
|
|
||||||
call clear_cube(cube)
|
call clear_cube(cube)
|
||||||
|
|
||||||
|
! and now, we loop over all the pre-computed
|
||||||
|
! points of the attractor
|
||||||
|
!
|
||||||
do foo=1, nbr_points
|
do foo=1, nbr_points
|
||||||
ix = nint(points(foo)%x * dble(DIM))
|
call fcoor2icoor(points(foo)%x, ix)
|
||||||
iy = nint(points(foo)%y * dble(DIM))
|
call fcoor2icoor(points(foo)%y, iy)
|
||||||
iz = nint(points(foo)%z * dble(DIM))
|
call fcoor2icoor(points(foo)%z, iz)
|
||||||
|
cube(ix,iy,iz) = cube(ix,iy,iz) + 1
|
||||||
enddo
|
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
|
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
|
end program voxelize
|
||||||
!-----------------------------------------------------
|
!-----------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user