Compare commits

...

6 Commits

Author SHA1 Message Date
tTh 6eac66c818 optimize for bbq 2024-01-30 13:32:43 +01:00
tTh ad82a68039 add finish to bloubs 2024-01-30 13:31:54 +01:00
tTh da681c3455 bloubworld is now a cube 2024-01-30 13:31:08 +01:00
tTh d2572ec80d oups... 2024-01-29 14:30:31 +01:00
tTh 5153e8437c bloubworld: tweaking merge function 2024-01-29 14:10:18 +01:00
tTh f9a93bf6f4 bloubworld: cleaning 2024-01-29 10:54:45 +01:00
5 changed files with 83 additions and 38 deletions

View File

@ -107,8 +107,8 @@ module bloubspace
integer :: errcode, output, foo, spitted
character(200) :: chaine
write (0, '(" spitting", (I6), " bloubs to ", (A), " file")') &
towrite, trim(fname)
! write (0, '(" spitting", (I6), " bloubs to ", (A), " file")') &
! towrite, trim(fname)
open( newunit=output, &
file=trim(fname), form='unformatted', &
@ -131,7 +131,8 @@ module bloubspace
enddo
close(output)
write(0, '(1X, "spitted ", I0, " bloubs.")') spitted
write(0, '(1X, "spitted ", I0, " bloubs to .", A)') &
spitted, trim(fname)
end subroutine spit_bloubs_to_file
! ----------------------------------------------------------------
@ -233,40 +234,47 @@ module bloubspace
real, parameter :: SH = 6.0
real, parameter :: SV = 4.0
logical :: flag
flag = .FALSE.
! X axis
if ((blb%px + blb%radius) .GT. SH) then
blb%vx = -1.0 * blb%vx
blb%px = SH - blb%radius
blb%age = blb%age + 1
endif
if ((blb%px - blb%radius) .LT. -SH) then
blb%vx = -1.0 * blb%vx
blb%px = -SH + blb%radius
blb%age = blb%age + 1
flag = .TRUE.
endif
! vertical axe Y
if ((blb%py - blb%radius) .LT. -SV) then
blb%vy = -1.0 * blb%vy
blb%py = -SV + blb%radius
blb%age = blb%age + 1
flag = .TRUE.
endif
if ((blb%py + blb%radius) .GT. SV) then ! overshoot ?
blb%vy = -1.0 * blb%vy
blb%age = blb%age + 1
blb%py = SV - blb%radius
flag = .TRUE.
endif
! Z axis
if ((blb%pz + blb%radius) .GT. SH) then
blb%vz = -1.0 * blb%vz
blb%age = blb%age + 1
blb%pz = SH - blb%radius
flag = .TRUE.
endif
if ((blb%pz + blb%radius) .LT. -SH) then
blb%vz = -1.0 * blb%vz
blb%age = blb%age + 1
blb%pz = -SH + blb%radius
flag = .TRUE.
endif
if (flag) then
blb%age = blb%age + 1
endif
end subroutine

View File

@ -73,9 +73,17 @@ contains
type(t_bloubs), intent(in) :: bla, blb
type(t_bloubs), intent(out) :: blr
real :: va, vb
!-
! XXX please insert here a static counter for the 'num' id
!-
blr%nick = "merged "
blr%num = 0 ! ???
va = bla%radius * bla%radius * bla%radius
vb = blb%radius * blb%radius * blb%radius
blr%px = (bla%px + blb%px) / 2.0
blr%py = (bla%py + blb%py) / 2.0
blr%pz = (bla%pz + blb%pz) / 2.0
@ -84,8 +92,8 @@ contains
blr%vy = (bla%vy + blb%vy) / 2.0
blr%vz = (bla%vz + blb%vz) / 2.0
blr%radius = (bla%radius + blb%radius)
blr%age = max(bla%age, blb%age)
blr%radius = (va + vb) ** 0.33333333333
blr%age = min(bla%age, blb%age)
! bring it to life !
blr%alive = .TRUE.

View File

@ -7,10 +7,10 @@
INCFILE="WS/bloubs.inc"
TMPPNG="/dev/shm/bloubs7.png"
POVOPT="+Q9 +a -v -d -W800 -H600 -WT2"
POVOPT="+Q9 +a -v -d -W1024 -H768 -WT2"
DDIR="frames/a"
LOGERR="log.error"
TXTCOLOR="#db2080"
TXTCOLOR="#db4090"
BLOUBDATAS="WS/bloubs.data"
BARYDATAS="WS/log.barycentres"
@ -34,12 +34,12 @@ printf "\n#declare NbImg = %d;\n" $NBIMG > WS/nbimg.inc
# first, we have to make a seminal buch of bloubs
# --> this function need to be parametrizable
#
./genbloubs ${BLBS_IN} 97
./genbloubs ${BLBS_IN} 666
for idx in $(seq 0 $((NBIMG-1)) )
do
echo "============== run passe $idx ===================="
echo "================= run passe $idx ===================="
# make the bloubs's data readable by POVray
#
@ -55,21 +55,20 @@ do
sleep 90
fi
td=$(date -u +'%F %R:%S' | tr '01' 'ol')
td=$(date -u +'%F %R' | tr '01' 'ol')
hi=$(printf "#%04d" $idx | tr '01' 'ol')
count=$(tail -1 "WS/log.nb_bloubs")
count=$(tail -1 "WS/log.nb_bloubs" | tr '01' 'ol')
PNG=$(printf "%s/%05d.png" ${DDIR} $idx)
convert ${TMPPNG} \
-font Courier-Bold \
-pointsize 22 \
-pointsize 32 \
-fill "$TXTCOLOR" \
-gravity south-east \
-annotate +25+5 "$td" \
-gravity south-west \
-annotate +25+5 "$hi" \
-pointsize 28 \
-gravity north-east \
-annotate +45+5 "$count" \
-gravity north-west \
@ -83,7 +82,7 @@ do
# mv ${BLBS_OUT} ${BLBS_IN}
echo "### run done"
sleep 10
sleep 5
done

View File

@ -44,16 +44,19 @@ union {
}
}
cylinder { 0, -y, 30 pigment { color White } translate -4.20*y}
cylinder { 0, -y, 30
texture {
pigment { color srgb <0.225, 0.244, 0.211> }
finish { phong 0.18 metallic 0.25 reflection 0.15 }
}
translate -6.20*y
}
sky_sphere {
pigment { color Gray20 }
emission rgb <0.1, 0.1, 0.1>
emission rgb <0.01, 0.01, 0.01>
}
// object { cylinder { <0, 0, 0>, <10, 0, 0>, 0.05 pigment { color Cyan } } }
// ----------------------------------------------------------
#declare Croisillon = object
@ -73,39 +76,63 @@ object { Croisillon scale 0.80 translate <Bary_X, Bary_Y, Bary_Z> }
// ----------------------------------------------------------
#declare BH = 6; // H = taille en horizontal
#declare BV = 4; // V = taille en vertical
#declare BV = 6; // V = taille en vertical
#declare BR = 0.056;
#declare Une_Borne = object
{
merge {
cylinder { <0, BV, 0>, <0, -BV, 0>, BR }
cylinder { <0, 0.036, 0>, <0, -0.036, 0>, BR*2 }
cylinder { <0, 0.042, 0>, <0, -0.042, 0>, BR*1.90 }
}
}
#local Ruc = BR * 0.90;
#local Rud = BR * 0.30;
#declare Un_Cadre = object
{
merge {
#local Ruc = BR * 0.90;
cylinder { <-BH, 0, -BH>, <-BH, 0, BH>, Ruc }
cylinder { < BH, 0, -BH>, < BH, 0, BH>, Ruc }
cylinder { < BH, 0, -BH>, <-BH, 0, -BH>, Ruc }
cylinder { < BH, 0, BH>, <-BH, 0, BH>, Ruc }
cylinder { < BH, 0, 0>, <-BH, 0, 0>, Rud }
cylinder { < 0, 0, -BH>, < 0, 0, BH>, Rud }
}
texture {
pigment { color Gray50 }
finish { phong 0.87 specular 0.57 }
}
}
#declare Montants = object
{
union {
cylinder { <-BH, -BH, 0>, <-BH, BH, 0>, Rud }
cylinder { < BH, -BH, 0>, < BH, BH, 0>, Rud }
cylinder { < 0, -BH, -BH>, < 0, BH, -BH>, Rud }
cylinder { < 0, -BH, BH>, < 0, BH, BH>, Rud }
}
texture {
pigment { color Gray50 }
finish { phong 0.57 specular 0.87 }
}
pigment { color Gray40 }
}
#declare Les_Bornes = object
{
union {
#local E = 0.0015;
#local E = 0.0005;
object { Un_Cadre translate y*(BV-E) }
object { Un_Cadre translate -y*(BV-E) }
object { Montants }
#local G = Green * 0.80;
object { Une_Borne translate <-BH, 0, -BH> pigment { color Blue } }
object { Une_Borne translate < BH, 0, -BH> pigment { color Green } }
object { Une_Borne translate <-BH, 0, BH> pigment { color Green } }
object { Une_Borne translate < BH, 0, -BH> pigment { color G } }
object { Une_Borne translate <-BH, 0, BH> pigment { color G } }
object { Une_Borne translate < BH, 0, BH> pigment { color Red } }
}
}
@ -133,12 +160,12 @@ union {
}
// ----------------------------------------------------------
light_source { <19, 12+NormClock, -17> color Gray80 }
light_source { <12, 10-NormClock, -29> color Gray70 }
light_source { < 19, 12+NormClock, -17> color Gray80 }
light_source { <-14, 10-NormClock, -29> color Gray70 }
#declare XCAM = 5 - ( 10 * NormClock);
#declare YCAM = -1.1 + (1.15 * NormClock);
#declare ZCAM = -16.50;
#declare YCAM = -1.1 + (1.25 * NormClock);
#declare ZCAM = -19.20;
#declare XLAT = 0;
#declare YLAT = 0;

View File

@ -35,13 +35,16 @@ BEGIN {
by += $2
bz += $3
pigment = "pigment { color " color " }"
printf "\tsphere { <%f, %f, %f>, %f %s }\n", \
printf "\tsphere { <%f, %f, %f>, %f \n\t\t%s }\n", \
$1, $2, $3, $4, pigment
count++
}
END {
print "\t} // end of union\n}\n"
# print "\t}\n"
print "\t} // end of union\n"
print "finish { phong 0.67 specular 0.57 }\n"
print "}\n"
print "#declare Nb_Bloubs = ", count, ";\n"
print "#declare Bary_X = ", bx/count, ";";
print "#declare Bary_Y = ", by/count, ";";