|
|
Here is an excerpt from the scene of the animation posted in p.b.a. with
some comments showing further syntax elements.
One important thing that is not yet possible is to be able to modify the
topology. Right now it can be generated and read in the scene, but
modifying it requires reading and writing the data file in the script.
This is possible since the file format is compatible to the #read and
#write routines, but it's somewhat ugly.
'load_file' and individual topology elements can be mixed so you can add
new elements to the simulation in each frame. I'm planning to add a
'enabled' flag to each mass so it can be 'turned off' too.
'save_file' saves after the simulation so loading and saving the same file
works.
MechSim_Generate_Grid() and MechSim_Show_Objects() are SDL macros, the
first generating a rectangular grid, the second showing the simulation
objects.
The fourth parameter of the environment function is used for taking into
account the movement of objects during the simulation on a sub-frame
level, the 'tim' parameter changes from 0 to 1 during the simulation of
each frame.
Comments welcome of course.
Christoph
// BEGIN SDL code
// Persistence Of Vision Ray Tracer Scene Description File
// File: test02.pov
// Vers: 3.5
// Desc: Mechanical simulation test scene
// Date: August 2002
#if (clock_on)
#declare FCnt=final_frame;
#else
#declare FCnt=10000;
#end
#declare fn_Move=
IC_Round_Box ( <-3, -1.2, -1>, <-5, 1.2, 3.2>, 0.2 )
#declare fn_NonMove=
IC_Merge3 (
IC_Plane(z, 0),
IC_Round_Box ( <0, -1.2, -1>, <-5, -2.2, 1.8>, 0.2 ),
IC_Round_Box ( <0, 1.2, -1>, <-5, 2.2, 1.8>, 0.2 )
)
#declare fn_Env=
function(x, y, z, tim) {
min(
fn_Move(x-(Clock+(tim/FCnt))*3, y, z),
fn_NonMove(x, y, z)
)
}
#declare Trans1 =
transform {
translate 2.5*z
translate -7*0.45*y
translate -1.6*x
}
global_settings {
max_trace_level 10
assumed_gamma 1
mechsim {
gravity <0, 0, -9.81>
environment {
function(x, y, z, tim) { fn_Env(x, y, z, tim) }
stiffness 280000
damping 50000
friction 0.1
}
collision {
off
stiffness 3000
damping 300
friction 0.1
}
#if (clock_on)
step_count 240
//time_step (1/30)/240
time 1/30
topology {
load_file "test_s.dat"
save_file "test_s.dat"
}
#else
step_count 0
time_step (1/30)/240
topology {
/*
mass {
<Position>,
<Velocity>,
Radius
[density Density | mass Mass]
[fixed on|off]
}
connection {
Index1,
Index2,
Length
[stiffness Stiffness]
[damping Damping]
}
face {
Index1,
Index2,
Index3
}
*/
//MechSim_Generate_Grid(Velocity, Radius, Density, Stiffness, Damping,
Faces, Cube_Scale, GridSize, Transf)
MechSim_Generate_Grid(<0, 0, 0>, 0.05, 12000*8, 20000, 4000, true, <0.45,
0.45, 0.45>, <3, 15, 3>, Trans1)
//load_file "test_s.dat"
save_file "test_orig2.dat"
}
#end
}
}
//MechSim_Show_Objects(Connect_Radius, Show_Faces, Show_Stress)
MechSim_Show_Objects(-1, true, false)
//#declare Test = mechsim:mass_count;
//#declare Test = mechsim:connection_count;
//#declare Test = mechsim:face_count;
//#declare Test = mechsim:mass(Index):radius;
//#declare Test = mechsim:mass(Index):mass;
//#declare Test = mechsim:mass(Index):position;
//#declare Test = mechsim:mass(Index):velocity;
//#declare Test = mechsim:connection(Index):index1;
//#declare Test = mechsim:connection(Index):index2;
//#declare Test = mechsim:connection(Index):length;
//#declare Test = mechsim:connection(Index):stiffness;
//#declare Test = mechsim:connection(Index):damping;
//#declare Test = mechsim:face(Index):index1;
//#declare Test = mechsim:face(Index):index2;
//#declare Test = mechsim:face(Index):index3;
// END SDL code
--
POV-Ray tutorials, IsoWood include,
TransSkin and more: http://www.tu-bs.de/~y0013390/
Last updated 03 Aug. 2002 _____./\/^>_*_<^\/\.______
Post a reply to this message
|
|