Compare commits
No commits in common. "5b6df523fc55abfd90fb342fb2545ec952c4019d" and "4853779493686ffb867527940df77d9a6bc4668f" have entirely different histories.
5b6df523fc
...
4853779493
@ -1,4 +1,4 @@
|
||||
program exportbloubs
|
||||
program genbloubs
|
||||
|
||||
use bloubspace
|
||||
implicit none
|
||||
@ -11,7 +11,7 @@ program exportbloubs
|
||||
! parsing command line
|
||||
i = IARGC()
|
||||
if (1 .ne. i) then
|
||||
STOP ' : BAD COMMAND LINE'
|
||||
STOP ' :BAD COMMAND LINE'
|
||||
endif
|
||||
call getarg(1, filename)
|
||||
|
||||
|
2
GravityField/.gitignore
vendored
2
GravityField/.gitignore
vendored
@ -11,7 +11,7 @@ WS/*/*.png
|
||||
*.log
|
||||
*.mp4
|
||||
|
||||
*.stderr
|
||||
pov.stderr
|
||||
|
||||
foo.pgm
|
||||
bar.pgm
|
||||
|
@ -3,9 +3,9 @@
|
||||
#
|
||||
|
||||
GFOPT = -Wall -Wextra -g -time -I../Modules
|
||||
MODOBJ = ../Modules/spitpgm.o
|
||||
MODOBJ = '../Modules/spitpgm.o'
|
||||
|
||||
all: essai animation
|
||||
all: essai
|
||||
|
||||
# ----------- modules
|
||||
|
||||
|
@ -1,23 +1,5 @@
|
||||
# Gravity Field Experiment
|
||||
# Gravity Field
|
||||
|
||||
_Some crude experiments to make fancy picture of a useless gravity field._
|
||||
Some crude experiments to make fancy picture of a useless gravaity field.
|
||||
|
||||
Expect bug party.
|
||||
|
||||
## Le module `realfield`
|
||||
|
||||
Les mécaniques sous-jacentes. Sans la moindre rigueur mathématique.
|
||||
|
||||
## Le commandeur en chef
|
||||
|
||||
C'est le logiciel sobrement nommé `animation` qui n'est absolument
|
||||
pas fini. Par exemple, il n'est absolument pas paramétrable sans
|
||||
passer per une recompilation.
|
||||
|
||||
## Le raytracing
|
||||
|
||||
Vous vous en doutez, c'est du POVray.
|
||||
|
||||
## Conclusion
|
||||
|
||||
Enjoy !
|
||||
|
@ -12,16 +12,15 @@ program animation
|
||||
! some configuration constants
|
||||
integer, parameter :: S_WIDTH = 1024
|
||||
integer, parameter :: S_HEIGHT = 1024
|
||||
integer, parameter :: NB_BODY = 82
|
||||
integer, parameter :: NB_BODY = 150
|
||||
|
||||
!!! WARNING : global variables !!!
|
||||
type(massbody) :: planets(NB_BODY)
|
||||
! integer :: foo
|
||||
|
||||
call init_random()
|
||||
call create_some_planets(planets, 1337e3, S_WIDTH , S_HEIGHT)
|
||||
call print_barycentre_bodies(planets)
|
||||
|
||||
! STOP 'BEFORE CRASH'
|
||||
call barycentre_bodies(planets)
|
||||
|
||||
call la_grande_boucle(0, 2000, planets)
|
||||
|
||||
@ -40,37 +39,25 @@ subroutine la_grande_boucle(start, nbre, moons)
|
||||
integer :: pass
|
||||
|
||||
do pass=start, start+nbre-1
|
||||
! if second parameter is TRUE, use clipping,
|
||||
! else use ?????ing
|
||||
call deplace_les_planetes(moons, .TRUE.)
|
||||
|
||||
write (filename, "(a, i5.5, a)") 'WS/nanim/', pass, '.pgm'
|
||||
write(0, '(3I5, " * ", a20)') start, nbre, pass, filename
|
||||
call build_and_write_a_field(S_WIDTH, S_HEIGHT, moons, filename)
|
||||
enddo
|
||||
write(0, *) filename
|
||||
|
||||
call print_barycentre_bodies(moons)
|
||||
call build_and_write_a_field(S_WIDTH, S_HEIGHT, moons, filename)
|
||||
|
||||
call deplace_les_planetes(moons)
|
||||
|
||||
enddo
|
||||
|
||||
end subroutine
|
||||
|
||||
!-----------------------------------------------------------------------
|
||||
!-
|
||||
! C'est ici que se passe le deplacement des choses mouvantes
|
||||
!-
|
||||
! Il y a deux manieres d'aborder les bords de l'univers (non, le combo
|
||||
! segfault/coredump n'en fait pas partie).
|
||||
!-
|
||||
subroutine deplace_les_planetes(moons, clipit)
|
||||
subroutine deplace_les_planetes(moons)
|
||||
type(massbody), intent(inout) :: moons(:)
|
||||
logical, intent(in) :: clipit
|
||||
|
||||
integer :: foo
|
||||
real :: depx, depy
|
||||
|
||||
integer, parameter :: EE = 45
|
||||
integer :: SW = S_WIDTH - EE
|
||||
integer :: SH = S_HEIGHT - EE
|
||||
|
||||
do foo=1, ubound(moons, 1)
|
||||
|
||||
! print *, "----- deplace ",foo, "serial ", moons(foo)%serial
|
||||
@ -81,24 +68,15 @@ subroutine deplace_les_planetes(moons, clipit)
|
||||
|
||||
!-
|
||||
! ici se pose une question pertinente sur la gestion des
|
||||
! bords du chanmp. Clipping, Toring or Boucing ?
|
||||
! bords du chanmp. Cclippin or Boucing ?
|
||||
!-
|
||||
if (clipit) then
|
||||
if (moons(foo)%posx .GT. SW) moons(foo)%posx = SW
|
||||
if (moons(foo)%posy .GT. SH) moons(foo)%posy = SH
|
||||
if (moons(foo)%posx .LT. EE) moons(foo)%posx = EE
|
||||
if (moons(foo)%posy .LT. EE) moons(foo)%posy = EE
|
||||
! STOP 'BECAUSE WE ARE TOTALY FUCKED'
|
||||
else
|
||||
if (moons(foo)%posx .GT. SW) moons(foo)%posx = EE
|
||||
if (moons(foo)%posy .GT. SH) moons(foo)%posy = EE
|
||||
if (moons(foo)%posx .LT. EE) moons(foo)%posx = SW
|
||||
if (moons(foo)%posy .LT. EE) moons(foo)%posy = SH
|
||||
endif
|
||||
if (moons(foo)%posx .GT. S_WIDTH) moons(foo)%posx = 0.0
|
||||
if (moons(foo)%posy .GT. S_HEIGHT) moons(foo)%posy = 0.0
|
||||
if (moons(foo)%posx .LT. 0) moons(foo)%posx = S_WIDTH
|
||||
if (moons(foo)%posy .LT. 0) moons(foo)%posy = S_HEIGHT
|
||||
|
||||
moons(foo)%heading = moons(foo)%heading + (0.25*(rand()-0.499999))
|
||||
moons(foo)%heading = moons(foo)%heading + (0.08*rand())
|
||||
if (moons(foo)%heading .GT. 6.2831853) moons(foo)%heading = 0.0
|
||||
if (moons(foo)%heading .LT. 0.0000001) moons(foo)%heading = 0.0
|
||||
|
||||
enddo
|
||||
|
||||
|
@ -27,7 +27,7 @@ case $filetype in
|
||||
esac
|
||||
echo "extension :" $extension
|
||||
|
||||
TITLE=$(printf -- '---{ experimental gravity field %d }---' $$)
|
||||
TITLE='---{ experimental gravity field }---'
|
||||
|
||||
ffmpeg -nostdin \
|
||||
-loglevel warning \
|
||||
@ -37,6 +37,6 @@ ffmpeg -nostdin \
|
||||
-c:v libx264 -pix_fmt yuv420p \
|
||||
$FNAME
|
||||
|
||||
echo $FNAME ' ..... [done]'
|
||||
echo
|
||||
|
||||
|
||||
|
@ -2,20 +2,16 @@
|
||||
|
||||
set -e
|
||||
|
||||
POVOPT=" -q9 +a -W1024 -H768 +WT2 -d -v "
|
||||
POVOPT=" -q9 +a -W1280 -H1024 +WT2 -d -v "
|
||||
SOURCE="vision.pov"
|
||||
TMPF="/dev/shm/gravfield.png"
|
||||
|
||||
date > pov.stderr
|
||||
|
||||
# ---------------------------------------
|
||||
|
||||
une_passe ()
|
||||
{
|
||||
clock=$1
|
||||
|
||||
cp pov.stderr old.stderr
|
||||
|
||||
povray -i${SOURCE} -K${clock} $POVOPT -O${TMPF} 2> pov.stderr
|
||||
|
||||
timestamp=$(date -u +'%F %H:%M' | tr '01' 'Ol')
|
||||
@ -24,14 +20,14 @@ outfile=$(printf "WS/troid/%05d.png" $clock)
|
||||
echo $timestamp $texte $outfile
|
||||
|
||||
convert ${TMPF} \
|
||||
-pointsize 24 \
|
||||
-pointsize 16 \
|
||||
-font Courier-Bold \
|
||||
-fill Orange \
|
||||
-annotate +15+16 "$timestamp" \
|
||||
-annotate +15+38 "$texte" \
|
||||
-pointsize 16 \
|
||||
-annotate +10+16 "$timestamp" \
|
||||
-annotate +10+34 "$texte" \
|
||||
-pointsize 8 \
|
||||
-gravity south-west \
|
||||
-annotate +15+6 "tTh & Konrad" \
|
||||
-annotate +10+6 "tTh & Konrad" \
|
||||
${outfile}
|
||||
}
|
||||
|
||||
@ -41,11 +37,12 @@ for foo in $(seq 0 1999)
|
||||
do
|
||||
echo '............' $foo
|
||||
une_passe $foo
|
||||
exit
|
||||
done
|
||||
|
||||
ffmpeg -nostdin \
|
||||
-loglevel warning \
|
||||
-y -r 30 -f image2 -i WS/troid/%05d.png \
|
||||
-y -r 30 -f image2 -i WS/trid/%05d.png \
|
||||
-metadata artist='---{ tTh and Konrad }---' \
|
||||
-metadata title="Experiment on Gravity Field" \
|
||||
-c:v libx264 -pix_fmt yuv420p \
|
||||
|
@ -9,12 +9,11 @@ module realfield
|
||||
implicit none
|
||||
|
||||
!-----------------------------------------------------------------------
|
||||
!-
|
||||
! definition of structures
|
||||
!-
|
||||
type massbody
|
||||
real :: posx = 0, posy = 0
|
||||
real :: heading = 0.29
|
||||
real :: posx, posy
|
||||
real :: heading = 0.21
|
||||
real :: speed = 1.017
|
||||
real :: mass = 1.0
|
||||
integer :: serial = 666
|
||||
@ -23,76 +22,63 @@ end type
|
||||
!-----------------------------------------------------------------------
|
||||
contains
|
||||
!-----------------------------------------------------------------------
|
||||
subroutine compute_barycentre_bodies(astres, bcx, bcy)
|
||||
subroutine barycentre_bodies(astres)
|
||||
type(massbody), intent(in) :: astres(:)
|
||||
real, intent(out) :: bcx, bcy
|
||||
integer :: foo
|
||||
real :: cx, cy
|
||||
|
||||
real :: cx, cy
|
||||
integer :: foo
|
||||
|
||||
!-
|
||||
! May be we have to use DOUBLE RPECSION here ?
|
||||
!-
|
||||
cx = 0.0
|
||||
cy = 0.0
|
||||
do foo=1, ubound(astres, 1)
|
||||
cx = cx + astres(foo)%posx
|
||||
cy = cy + astres(foo)%posy
|
||||
enddo
|
||||
bcx = cx / real(ubound(astres, 1))
|
||||
bcy = cy / real(ubound(astres, 1))
|
||||
end subroutine
|
||||
!-----------------------------------------------------------------------
|
||||
subroutine print_barycentre_bodies(astres)
|
||||
type(massbody), intent(in) :: astres(:)
|
||||
real :: cx, cy
|
||||
|
||||
call compute_barycentre_bodies(astres, cx, cy)
|
||||
print *, "barycentre : ", cx, cy
|
||||
cx = cx / real(ubound(astres, 1))
|
||||
cy = cy / real(ubound(astres, 1))
|
||||
print *, 'barycentre:', cx, cy
|
||||
|
||||
end subroutine
|
||||
!-----------------------------------------------------------------------
|
||||
!-
|
||||
! make a few solid body to play with...
|
||||
!-
|
||||
! planets : an array of type(massbody) to be filled
|
||||
! coef : for setting the mass of the body
|
||||
! sx, sy : borders of the universe
|
||||
!-
|
||||
subroutine create_some_planets(planets, coef, sx, sy)
|
||||
type(massbody), intent(inout) :: planets(:)
|
||||
real, intent(in) :: coef
|
||||
integer, intent(in) :: sx, sy
|
||||
|
||||
integer :: foo
|
||||
character(100) :: fmt
|
||||
|
||||
fmt = "(I4, ' | ', 2(F10.2, ' '), ' | ', 2F9.3, ' ', e12.3, I7)"
|
||||
|
||||
do foo=1, ubound(planets, 1)
|
||||
if (foo .EQ. 1) then
|
||||
!-
|
||||
! the first planet is the home of Johnny Root
|
||||
!-
|
||||
if (foo .EQ. 1) then
|
||||
planets(1)%posx = sx / 2
|
||||
planets(1)%posy = sy / 2
|
||||
planets(1)%mass = 29e8
|
||||
planets(1)%mass = 37e8
|
||||
planets(1)%serial = 1337
|
||||
planets(1)%speed = 6.666
|
||||
else
|
||||
!-
|
||||
! others are planets for peones
|
||||
!-
|
||||
planets(foo)%posx = rand() * real(sx-1)
|
||||
planets(foo)%posy = rand() * real(sy-1)
|
||||
planets(foo)%mass = 7e6 + coef*foo
|
||||
planets(foo)%heading = 3.14159 * rand()
|
||||
if (rand() .LT. 0.08) planets(foo)%speed = 3.14159
|
||||
if (rand() .LT. 0.01) planets(foo)%speed = 2.718
|
||||
planets(foo)%serial = foo*2 + 120
|
||||
endif
|
||||
write (*, fmt) foo, planets(foo)
|
||||
enddo
|
||||
|
||||
end subroutine
|
||||
!-----------------------------------------------------------------------
|
||||
!-
|
||||
! the basis of the kluge
|
||||
!-
|
||||
|
||||
function compute_gravity(fx, fy, body)
|
||||
real, intent(in) :: fx, fy
|
||||
type(massbody), intent(in) :: body
|
||||
@ -102,7 +88,7 @@ function compute_gravity(fx, fy, body)
|
||||
rx = fx - body%posx
|
||||
ry = fy - body%posy
|
||||
dist = sqrt( (rx*rx) + (ry*ry) )
|
||||
if (dist .LT. 0.08) then
|
||||
if (dist .LT. 0.11) then
|
||||
! write (0, *) "dist too small ", dist
|
||||
compute_gravity = 0e0
|
||||
else
|
||||
|
@ -2,9 +2,9 @@
|
||||
|
||||
set -e # stop on error
|
||||
|
||||
make animation
|
||||
make essai
|
||||
|
||||
time ./animation | tee animation.log
|
||||
time ./essai | tee essai.log
|
||||
|
||||
./encode.sh WS/nanim/ quux.mp4
|
||||
./encode.sh WS/field/ foo.mp4
|
||||
|
||||
|
@ -14,7 +14,6 @@ global_settings {
|
||||
#include "colors.inc"
|
||||
|
||||
#declare NormClock = clock / 2000.01;
|
||||
#debug concat("- - - - - - - ", str(NormClock, 7, 5), "\n")
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@ -36,17 +35,11 @@ texture {
|
||||
}
|
||||
}
|
||||
|
||||
object { GravityField scale <4, 0.60, 4> }
|
||||
object { GravityField scale <4, 0.70, 4> }
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
/* XXX
|
||||
merge {
|
||||
cylinder { <0, -0.5, 0>, <0, 1, 0>, 0.0175 }
|
||||
sphere { <0, 1, 0>, 0.0175 }
|
||||
pigment { color Red }
|
||||
}
|
||||
XXX */
|
||||
cylinder { <0, -0.5, 0>, <0, 1, 0>, 0.0175 pigment { color Red } }
|
||||
|
||||
light_source { < -2, 9.3, -7> color Gray90 }
|
||||
light_source { < -6, 9.3, -8> color Orange*0.75 }
|
||||
@ -55,10 +48,10 @@ light_source { < -15, 2.3, 17> color Green*0.25 }
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
camera {
|
||||
location <-8, 4-NormClock, 1 + (5*NormClock)>
|
||||
location <-8, 4-NormClock, 1 + 3*NormClock>
|
||||
look_at <0, 0, 0>
|
||||
right x*image_width/image_height
|
||||
angle 33
|
||||
angle 34
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user