POV-Ray : Newsgroups : povray.unofficial.patches : MegaPOV mechsim environment collisions Server Time
29 Jun 2024 00:14:01 EDT (-0400)
  MegaPOV mechsim environment collisions (Message 1 to 4 of 4)  
From: Mack Tuesday
Subject: MegaPOV mechsim environment collisions
Date: 22 May 2003 22:55:04
Message: <web.3ecd8d002dbd02f25f597a2b0@news.povray.org>
Has anyone ever seen Sodaplay's SodaConstructor?  It's at
( http://sodaplay.com/constructor/index.htm )  It's a very simple
2-D mechanical simulator that makes little walking objects by
driving the springs in the mass-spring model with sinusoids.

I wanted to do the same thing in MegaPOV but I'm running into
problems.  The first thing I tried was to open the save_file,
read the values, update the "length" fields, and then explicitly
declare the masses and connections in the topology settings.  So
in this case I wasn't declaring the load_file.  This worked fine
except collisions with the environment failed completely -- my
masses fell through the ground as if it weren't there.

So then what I did was open the save_file, read the values,
update the "length" fields, and then *rewrite* another file from
scratch and use it as the load_file, rather than declare the
masses and connections explicitly as I had in the first case.
This works better but I'm still finding that my masses submerge
completely under the ground before the simulation seems to
understand that a collision has happened.

I increased the second friction value (the one that's 1.001 in
the tutorial examples) to 10.  That seemed to help a little.  I
also made sure the environment was really stiff.  This might
also have helped but the problem is basically still there.

Even in the tutorial examples the masses tend to fall past the
ground level too much.  I would understand if they were being
treated as point masses and the collisions were tested between
the environment and the center of the sphere, but even so I'm
pretty certain that the centers of the masses are falling past
the ground level anyway.

Any comments?  I would post my code but it would take some work
to pare it down, and I tested my code pretty thoroughly to make
sure where the problem actually lies.  I really don't think
posting my code would shed any light on the problem, but I'll
do that if someone insists that it's necessary.


Post a reply to this message

From: Christoph Hormann
Subject: Re: MegaPOV mechsim environment collisions
Date: 23 May 2003 02:06:46
Message: <3ECDBA75.B1C017AC@gmx.de>
Mack Tuesday wrote:
> 
> Has anyone ever seen Sodaplay's SodaConstructor?  It's at
> ( http://sodaplay.com/constructor/index.htm )  It's a very simple
> 2-D mechanical simulator that makes little walking objects by
> driving the springs in the mass-spring model with sinusoids.
> 
> I wanted to do the same thing in MegaPOV but I'm running into
> problems.  The first thing I tried was to open the save_file,
> read the values, update the "length" fields, and then explicitly
> declare the masses and connections in the topology settings.  So
> in this case I wasn't declaring the load_file.  This worked fine
> except collisions with the environment failed completely -- my
> masses fell through the ground as if it weren't there.

Could you please rephrase your description in a more understandable form? 
I have no idea what 'declaring the load_file' means for example.

> [...]
> 
> Even in the tutorial examples the masses tend to fall past the
> ground level too much.  I would understand if they were being
> treated as point masses and the collisions were tested between
> the environment and the center of the sphere, but even so I'm
> pretty certain that the centers of the masses are falling past
> the ground level anyway.

Which of the sample scenes are you referring to?

The interaction with the environment can be adjusted with the environment
parameters and the environment method.  See the section 'The environment
properties' in the docs.  If you choose a realistic value for the
stiffness you will also get natural results but you usually want to use
somewhat lower values or use the impact based method to speed up
integration.

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 28 Feb. 2003 _____./\/^>_*_<^\/\.______


Post a reply to this message

From: Mack Tuesday
Subject: Re: MegaPOV mechsim environment collisions
Date: 23 May 2003 18:30:01
Message: <web.3ecea0263284c5185f597a2b0@news.povray.org>
Christoph Hormann wrote:
>
>Could you please rephrase your description in a more understandable form?
>I have no idea what 'declaring the load_file' means for example.

Sorry.  Now I see that my ramblings weren't clear.  I also
failed to mention that your work is very impressive and it's
wonderful that you have made this functionality available!  I
think I sounded overly negative in my first post and I didn't
mean to.

This is what I tried first:  I opened sim.dat before the
global_settings section and read the values out.  Now I want
the relaxed lengths of the springs to vary over time according
to a sinusoid function of this form:

C + A*sin(F*t + P)

where A is amplitude, F is frequency, P is phase, and C is some
offset to make sure the length doesn't fall below zero.  So I
updated the "length" values of the connections for the current
frame.  At this point I had all the data I need to explicitly
give complete "mass" and "connection" declarations in the
topology section.  So my topology section *didn't* look like this:

topology {
  ...stuff...
  #if (clock = 0)
  ...stuff...
  #else
    load_file "mechsim.dat"
  #end
  save_file "mechsim.dat"
}

Rather, it looked like this:

topology {
  ...stuff...
  #declare i = 0;
  #while (i < NumMasses)
    mass { ...stuff... }
    #declare i = i + 1;
  #end
  #declare i = 0;
  #while (i < NumConnections)
    connection { ...stuff... }
  #end
  save_file "mechsim.dat"
}

So I explicitly declared my masses and connections instead
of declaring a load_file, regardless of the clock value.
This approach led to the masses falling straight through
the environment.

This is what I tried next:  I changed the topology section
to look like this:

topology {
  ...stuff...
  load_file "mechsim1.dat"
  save_file "mechsim2.dat"
}

Before the global_settings section, I opened mechsim2.dat,
read in the values, and updated the length values just like
before.  This time, however, I wrote the values back into
the other file, mechsim1.dat, and forced the simulator to
open mechsim1.dat itself to get the values.  This works
much better but some of the masses still often end up
completely submerged under the surface of the environment.

I'll look at the documentation again but I reviewed it many
times to see what I might have missed.  I'll try increasing
the environment stiffness even more to see if that helps.

>
>Which of the sample scenes are you referring to?
>

I was talking about the one where the long grid falls on
top of the big block.  I think it's example number 5.


Post a reply to this message

From: Christoph Hormann
Subject: Re: MegaPOV mechsim environment collisions
Date: 25 May 2003 05:08:52
Message: <3ED08823.F4020BDB@gmx.de>
Mack Tuesday wrote:
> 
> [...]
> 
> So I explicitly declared my masses and connections instead
> of declaring a load_file, regardless of the clock value.

I now understand what you are talking about but you should not get used to
these formulations since they are not correct.  You simply read the data
file via POV-Ray's file reading functions and generate the topology from
the read data.

> This approach led to the masses falling straight through
> the environment.

Here you are obviously doing something wrong but you did not provide
enough information to point out the problem.

> [...]
> 
> >
> >Which of the sample scenes are you referring to?
> >
> 
> I was talking about the one where the long grid falls on
> top of the big block.  I think it's example number 5.

This sample scene works completely as intended.  Note that the masses are
not supposed to stay completely outside the environment when using default
environment method.  

Christoph

-- 
POV-Ray tutorials, include files, Sim-POV,
HCR-Edit and more: http://www.tu-bs.de/~y0013390/
Last updated 28 Feb. 2003 _____./\/^>_*_<^\/\.______


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.