POV-Ray : Newsgroups : povray.animations : Help with SDL for Bouncing Ball Server Time
18 Apr 2024 08:59:30 EDT (-0400)
  Help with SDL for Bouncing Ball (Message 5 to 14 of 22)  
<<< Previous 4 Messages Goto Latest 10 Messages Next 8 Messages >>>
From: dick balaska
Subject: Re: Help with SDL for Bouncing Ball
Date: 28 Dec 2016 01:57:45
Message: <58636269$1@news.povray.org>
Am 2016-12-27 17:32, also sprach Bald Eagle:

> I was wondering if anyone had any practical and concrete advice on how to handle
> the various parts of the animation, and how to organize the code in a sensible
> manner.

A plug for my "movie": http://www.buckosoft.com/tteoac/

I use basic physics for my sphere's motion.  Each sphere has a position 
and a vector. The vector is updated based on gravity and added to the 
position.  Then the position is tested for bouncing and the vector 
modified. (I sort of squish my volcano (cone) before it erupts. ;) )
To squish spheres, I would add a squishFactor = 0; and squishMax = r/2;
   if (sphere.y - r < 0) squishAccelerate = 0.5;
Then iterate,
   squishAccelerate gets added to squishFactor,
   squishAccelerate gets updated, while squishing decrement towards 0
   sphere gets drawn as r - squishFactor.

Hmm, I may have to see what squishing looks like on my spew. :)
My bouncing code is here http://tinyurl.com/jcg8g4s [1]
but it won't help you because it's Java. Once I started testing 1500 
spheres bouncing off of each other I was looking at 24 hour parse times 
in povray, so I moved that off to Java which spits out povray source 
like this. http://tinyurl.com/zk9d9t5 [2]

I break down every move so that at it's fundamental, every move runs 
from 0.0-1.0, so normal sphere (0.0) would be squishFactor = 0 and 
squished (1.0) would be squishFactor = r/2;

But you can't run squishFactor linearly from 0.0-1.0, that looks too 
robotic.  I apply an acceleration curve like Curve0 on this page.
http://www.buckosoft.com/~dick/pov/curves/
So while my timer runs 0.0-1.0, squishFactor is massaged by that quarter 
cosine.

This is all probably way more complicated than you want, ;)
but that's how I do it.

-- 
dik

[1] alias for 
http://git.buckosoft.com/gitweb/pov.cgi?p=TteoacService.git;a=blob;f=src/main/java/com/buckosoft/povspew/tteoac/Volcano/VolcanoRunner.java;h=3ec758b0504ad201ecbd847dc695dfe30927fc7e;hb=HEAD

[2] alias for 
http://www.buckosoft.com/tteoac/tteoac/service?scene=tteo|fps=23.976|type=Volcano|frame=1900


Post a reply to this message

From: clipka
Subject: Re: Help with SDL for Bouncing Ball
Date: 28 Dec 2016 02:11:49
Message: <586365b5@news.povray.org>
Am 27.12.2016 um 23:32 schrieb Bald Eagle:
> The subject of creating a "simple" animation of a bouncing ball recently came
> up, and as I looked into it, and considered how to do this, it is apparently
> less simple than I thought it would be.

... or maybe you're currently seeing more complications than there are ;)

> I would imagine that a critical factor in making the animation work out well
> would be to find the total time for the ball to (practically) come to rest, and
> then define the number of frames in the animation based on that.

The problem there is that there is no single true answer; the solution
is that there is a host of them, and you can freely choose one.

The time the ball remains in contact with the surface essentially
depends on one single parameter: The combined ball's and surface's
resistance to being deformed. You can express this as a force, which for
simplicity's sake you can pretend as being roughly proportional to the
distance by which the ball has already moved beyond the point of
contact, and this force will counteract gravity. To work out the
equation for the ball's movement shouldn't be much more difficult than
working out the equation for a ball in free flight, except that this
time you have a cubic rather than quadratic equation.

If you're going for the simple hack of just keeping the ball stationary
for a few moments anyway, you can essentially choose any time you like,
so long as you don't violate fundamental physical limits (a ball so
easily deformable that it would sink in by more than its own diameter
doesn't make much sense ;))


Post a reply to this message

From: Bald Eagle
Subject: Re: Help with SDL for Bouncing Ball
Date: 3 Jan 2017 12:40:01
Message: <web.586be1bfccfba4d9c437ac910@news.povray.org>
I was just checking out some further stuff on this and found:

http://scienceblogs.com/startswithabang/files/2012/09/PWjWR.gif

Wowza.  :O
That looks like a cool spherical harmonic isosurface to model!   ;)

from:
http://scienceblogs.com/startswithabang/2012/09/15/weekend-diversion-the-physics-of-happy-gilmore/


Post a reply to this message

From: omniverse
Subject: Re: Help with SDL for Bouncing Ball
Date: 4 Jan 2017 08:15:00
Message: <web.586cf4b2ccfba4d99c5d6c810@news.povray.org>
"Bald Eagle" <cre### [at] netscapenet> wrote:
> I was just checking out some further stuff on this and found:
>
> http://scienceblogs.com/startswithabang/files/2012/09/PWjWR.gif
>
> Wowza.  :O
> That looks like a cool spherical harmonic isosurface to model!   ;)
>
> from:
>
http://scienceblogs.com/startswithabang/2012/09/15/weekend-diversion-the-physics-of-happy-gilmore/

Heck, I knew a golf club bends a little and ball would deform slightly but sure
didn't realize it was like that.
The 50 pound plate hit makes the ball look unreal. In fact, I can hardly believe
it isn't bursting apart instead of flattening out, and then able to reshape like
a soft-boiled egg.

Once when a teenager I peeled a golf ball down to a small inner rubber core
(liquid-filled? I forget), lots of rubbery strands between the hard plastic
shell and that. Just never thought of the shell itself as being pliable enough
to stretch so much.


Post a reply to this message

From: Stephen
Subject: Re: Help with SDL for Bouncing Ball
Date: 4 Jan 2017 08:34:42
Message: <586cf9f2@news.povray.org>
On 1/4/2017 1:12 PM, omniverse wrote:

>
> Once when a teenager I peeled a golf ball down to a small inner rubber core
> (liquid-filled? I forget), lots of rubbery strands between the hard plastic
> shell and that. Just never thought of the shell itself as being pliable enough
> to stretch so much.
>
>
>
I think you are showing your age. :-P
At least it wasn't filled with feathers. :-)

If I remember correctly, my grandfather ;-) told me it was a white paint 
like liquid.

-- 

Regards
     Stephen


Post a reply to this message

From: Stephen
Subject: Re: Help with SDL for Bouncing Ball
Date: 5 Jan 2017 08:48:13
Message: <586e4e9d$1@news.povray.org>
On 12/27/2016 10:32 PM, Bald Eagle wrote:
> I think for a good animation, there would need to be a good way to handle the
> squashing of the ball and the deceleration prior to restoring the ball to a
> sphere and resuming the bouncing cycle.


I don't know if this will be of any use. It has equations in it, though. :-)

http://www.beosil.com/download/MeshlessDeformations_SIG05.pdf

I have just started to use Blender's Bullet Physics and came across this.


-- 

Regards
     Stephen


Post a reply to this message

From: Thomas de Groot
Subject: Re: Help with SDL for Bouncing Ball
Date: 6 Jan 2017 02:57:48
Message: <586f4dfc$1@news.povray.org>
On 5-1-2017 14:47, Stephen wrote:
> On 12/27/2016 10:32 PM, Bald Eagle wrote:
>> I think for a good animation, there would need to be a good way to
>> handle the
>> squashing of the ball and the deceleration prior to restoring the ball
>> to a
>> sphere and resuming the bouncing cycle.
>
>
> I don't know if this will be of any use. It has equations in it, though.
> :-)
>
> http://www.beosil.com/download/MeshlessDeformations_SIG05.pdf
>
> I have just started to use Blender's Bullet Physics and came across this.
>
>

The rubber duck is fascinating :-)

-- 
Thomas


Post a reply to this message

From: Bald Eagle
Subject: Re: Help with SDL for Bouncing Ball
Date: 6 Jan 2017 12:50:00
Message: <web.586fd7d5ccfba4d9c437ac910@news.povray.org>
Stephen <mca### [at] aolcom> wrote:

> I don't know if this will be of any use. It has equations in it, though. :-)
>
> http://www.beosil.com/download/MeshlessDeformations_SIG05.pdf

Thanks - that looks interesting, from a mathematical modeler's point of view,
anyway   ;)

I always find it odd that papers like that don't mention what software they used
to make the images.


Post a reply to this message

From: Bald Eagle
Subject: Re: Help with SDL for Bouncing Ball
Date: 6 Jan 2017 12:55:01
Message: <web.586fd936ccfba4d9c437ac910@news.povray.org>
So, I worked out a bit of code, and naturally the things I thought might work
didn't, and the half-edited stuff that I just said "aw, heck - lemme just click
the RUN button and see what happens..." works unexpectedly well.

Still some funny business I have to debug.

Of special interest was this:
http://physics.stackexchange.com/questions/245791/explicit-function-for-bouncing-ball?rq=1

though I can't quite seem to get his equation for K to work, because obviously,
E-1 is negative, multiplying that by T doesn't solve that, and then adding 1
doesn't bring it into the positive realm.
So I get a log of negative number! error

Any thoughts what my error in reading / interpreting / coding / implementation
is?

#declare E = 0.75;  // (Greek ksi)

#for (T, 0, 25)

 #declare K = floor(log( (E-1)*T+1 ) / log(E)); // log [base E] ( (E-1)*T + 1 )
 #declare Y = (1/2)*pow(E, K*T) * (T-(pow(E, K*T)-1)/E-1) - (1/2)*pow((T-(pow(E,
K*T)-1)/E-1),2);

 sphere {0, 2 pigment {Red} translate <T*10, Y, 0> }

#end


Post a reply to this message

From: Stephen
Subject: Re: Help with SDL for Bouncing Ball
Date: 6 Jan 2017 13:48:24
Message: <586fe678@news.povray.org>
On 1/6/2017 5:45 PM, Bald Eagle wrote:
> Stephen <mca### [at] aolcom> wrote:
>
>> I don't know if this will be of any use. It has equations in it, though. :-)
>>
>> http://www.beosil.com/download/MeshlessDeformations_SIG05.pdf
>
> Thanks - that looks interesting, from a mathematical modeler's point of view,
> anyway   ;)
>
> I always find it odd that papers like that don't mention what software they used
> to make the images.
>
>
>


If you want to dig into it in depth. You could always look into the code 
of Bullet physics and see how they do it.

-- 

Regards
     Stephen


Post a reply to this message

<<< Previous 4 Messages Goto Latest 10 Messages Next 8 Messages >>>

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