POV-Ray : Newsgroups : povray.advanced-users : Math help needed please. Server Time
30 Jul 2024 18:22:58 EDT (-0400)
  Math help needed please. (Message 11 to 20 of 40)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Ronald L  Parker
Subject: Re: Math help needed please.
Date: 18 Apr 1999 23:24:10
Message: <371a92b2.155162657@news.povray.org>
On Sun, 18 Apr 1999 20:32:57 -0500, Bob Hughes <inv### [at] aolcom>
wrote:

>Warning! I'm not a "Advanced User" I just play one on the home computer.
>
>If I gather this right, sounds like you need a sin cos type thing for
>the translation (one for x and one for y). 

Consider this a step toward "Advanced Userhood", then: vrotate will
almost always do what you think you need sin and cos for, and will
usually be easier to read as well when you need to come back to it in
a month or two.


Post a reply to this message

From: Bob Hughes
Subject: Re: Math help needed please.
Date: 19 Apr 1999 02:19:07
Message: <371ABCA7.E7C945DC@aol.com>
I can dream, yes :)
About the question at hand, I tried several potential ways via the sin
and pi and exp, etc. and failed to get the right answer. Math is not my
major good point, if I even have one at all.
Thing is this sounded simple enough. Scaling to meet the floor plane is
all while moving in a semi-circle, should just be a half sinusoidal
scale in the y.
I noticed Ken said:
----snipsity----
  #declare Diam = 1;

 sphere {0, Diam
         scale clock*0.5
         rotate clock*180*z
         translate < -0.5*clock, -Diam*0.5/2*clock, 0 >
         texture { MyTexture }
       }
 
  I think !
----snipperoonie---

'scale clock*0.5' is a wrong move. That will start as scale 1 then jump
back down to near nothing as it then climbs back up again. You'll
realize soon enough I'm sure.
And I realize I will always have something to learn. Thanks for the
little push Ron, I need that every so often.


"Ronald L. Parker" wrote:
> 
> Consider this a step toward "Advanced Userhood", then: vrotate will
> almost always do what you think you need sin and cos for, and will
> usually be easier to read as well when you need to come back to it in
> a month or two.

-- 
 omniVERSE: beyond the universe
  http://members.aol.com/inversez/homepage.htm
 mailto:inv### [at] aolcom?Subject=PoV-News


Post a reply to this message

From: Josh English
Subject: Re: Math help needed please.
Date: 19 Apr 1999 13:33:46
Message: <371B5AB6.70BF3BFF@spiritone.com>
errrmmmmmm...... It won't work. let me explain.  Asphere with a radius of 1 has a
circumference of  2pi (roughly 6.2831 something something something). To model this
realistically, if the sphere were to rotate clockwise around the z axis one whole
revolution
then the appropriate movement along the x axis would be 2pi units long. Half the
rotation of
the ball is pi across the x axis (3.14159 and change). Moving only 1 unit would result
in the
ball spinning faster than it was moving. Fine for cue balls and Fred Flintstone (ever
notice
how his feet slide across the ground when he's walking?)

It sounds like the placement of the sphere is more important than how much it rotates,
so we
need to alter the amount of rotation. Keeping a ratio of 180/pi, where pi is the
distance
traveled and 180 is the rotation, we can create a formula or x/1 = 180/pi. x is the
rotation
needed to move 1 unit, and it is baiscally 57.295 plus a little extra. (At this point
I am
very grateuful that POV-Ray has pi as a built in value, thus saving lots of
calculations.)

Here is some code to generalize the movement:

#declare start_point = -0.5;
#declare end_point = 0.5;

#declare distance = end_point - start_point; // should be 1 in this example

#declare start_rotation = 0;
#declare end_rotation = distance*(180/pi);
#declare range = end_rotation - start_rotation;

// Now assume that the clock is going from 0 to 1, if it isn't the appropriate
formulas are at

// http://www.spiritone.com/~english/animaker/animaker.html

#declare current_rotation = start_rotation + (range * clock);
#declare current_translation = start_point + (distance * clock);
sphere { <0,0,0> 1
                texture { MyTexture }
                rotate current_rotation*z
                translate current_translation * x
             }

plane { y, -1
             texture { MyOtherTexture } }


This covers the basics... altering the shape of the thing is slightly more complicated
to
calculate... but I'll look into it.

Josh English
eng### [at] spiritonecom



Andrew Cocker wrote:

> Hi,
>
> Starting with the following code:
>
> sphere {
>     <0,0,0>,1
>     scale <0.25,1,0.25>
>     translate <-0.5,0,0>
>     texture { MyTexture }
> }
>
> plane
>
>     y, -1
>     texture { MyTexture }
> }
>
> I wish to rotate the sphere clockwise on the z axis by 180 degrees, at the same time
> translating it along the x axis by 1 unit, so that it ends up at <0.5,0,0>.
> The question is, how do I mathematically model the vertical motion so that the shape
> appears to be rolling along the plane?NOTE: I may wish to alter the scale of the
shape
> *during* the anim, so this must be taken into account in the equation.
>
> Any help appreciated.
>
> --
> ----------------------
> Andy
>
------------------------------------------------------------------------------------------
> -
> --The Home Of Lunaland--
> --visit my POV-Ray gallery--
> --listen to my music--
> www.acocker.freeserve.co.uk


Post a reply to this message

From: Peter Popov
Subject: Re: Math help needed please.
Date: 19 Apr 1999 14:04:20
Message: <371b5d6a.3508620@news.povray.org>
On Sun, 18 Apr 1999 22:39:41 +0100, "Andrew Cocker"
<and### [at] acockerfreeservecouk> wrote:

>Hi,
>
>Starting with the following code:
>
>sphere {
>    <0,0,0>,1
>    scale <0.25,1,0.25>
>    translate <-0.5,0,0>
>    texture { MyTexture }
>}
>
>plane
>
>    y, -1
>    texture { MyTexture }
>}
>
>I wish to rotate the sphere clockwise on the z axis by 180 degrees, at the same time
>translating it along the x axis by 1 unit, so that it ends up at <0.5,0,0>.
>The question is, how do I mathematically model the vertical motion so that the shape
>appears to be rolling along the plane?NOTE: I may wish to alter the scale of the
shape
>*during* the anim, so this must be taken into account in the equation.
>
>Any help appreciated.

Now, a 180 degrees' roll of this objects makes for a x translation of
3.14159265, if you want it to roll correctly. If I understand your
question correctly, you are trying to model the behaviour of, say, an
unrolling rug, right? I mean, it moves, rolls, gets smaller, and stays
on the ground all at the same time.

The radius is a simple linear function:
 r(clock) = startRad - clock*(startRad - endRad).

The y coordinate of the center is -1 + radius.

The x coordinate is found by integrating 2*pi*r(clock)*dclock in the
range from 0 to clock.

Am I getting the problem right? Is this of any help?

---------
Peter Popov
ICQ: 15002700


Post a reply to this message

From: Andrew Cocker
Subject: Re: Math help needed please.
Date: 19 Apr 1999 17:34:18
Message: <371b934a.0@news.povray.org>
Peter Popov <pet### [at] usanet> wrote in message
news:371b5d6a.3508620@news.povray.org...

> Now, a 180 degrees' roll of this objects makes for a x translation of
> 3.14159265, if you want it to roll correctly. If I understand your
> question correctly, you are trying to model the behaviour of, say, an
> unrolling rug, right? I mean, it moves, rolls, gets smaller, and stays
> on the ground all at the same time.

Err, no, just a sphere scaled into an ellipse rolling along. I realise I was wrong
expecting to be able to rotate 180 degrees in 1 unit, and I should now use 3.141...,
it's
the vertical position of the centre of the ellipse that I am still unclear about..how
it
moves down and then back up whilst keeping in contact with the floor. Surely this
value
will vary depending on the rotation, not the scale of the sphere. Forget that I
mentioned
changing the scale mid-anim..if I can get this to work as is, then I'll be happy.

> The y coordinate of the center is -1 + radius.
>
> The x coordinate is found by integrating 2*pi*r(clock)*dclock in the
> range from 0 to clock.
>

I'm fairly clear on this

> Am I getting the problem right? Is this of any help?

I'm slightly less in the dark, but no-one's switched the floodlights on yet ;-)

Andy


Post a reply to this message

From: Margus Ramst
Subject: Re: Math help needed please.
Date: 19 Apr 1999 19:44:27
Message: <371bb1cb.0@news.povray.org>
Andrew Cocker wrote in message <371b934a.0@news.povray.org>...
>
>Err, no, just a sphere scaled into an ellipse rolling along. I realise I
was wrong
>expecting to be able to rotate 180 degrees in 1 unit, and I should now use
3.141..., it's
>the vertical position of the centre of the ellipse that I am still unclear
about..how it
>moves down and then back up whilst keeping in contact with the floor.
Surely this value
>will vary depending on the rotation, not the scale of the sphere. Forget
that I mentioned
>changing the scale mid-anim..if I can get this to work as is, then I'll be
happy.
>


First, remember that the cirumference of an ellipse is not 2*pi*r. An
approximation is 2*pi*sqrt[(a^2+b^2)/2] where a and b are lengths of major
and minor axes.

The other value you want - I haven't got right now. But why not just do
this: use the Superpatch's trace() function; trace a line from the centre
straight down. You can now get the radius for the current angle.

Basically like this:

#declare Ellipse=sphere{0,1 scale <.25,1,.25> rotate z*clock*360}
#declare Rad=trace(Ellipse,0,-y).y;

At least I think this should work.

Margus


Post a reply to this message

From: Bob Hughes
Subject: Re: Math help needed please.
Date: 19 Apr 1999 19:46:39
Message: <371BB225.808E7997@aol.com>
Ah ha. I was trying to rescale the sphere vertically while rotating and
keeping it lengthwise in the vertical. Then as it moved across the floor
it would grow and shrink back again as it moved upward and back down.
All wrong.
You needed an ellipse "rolling" along shorter diameter going closer then
back to starting orientation with the floor. I see now. Maybe.


Andrew Cocker wrote:
> 
> Peter Popov <pet### [at] usanet> wrote in message
> news:371b5d6a.3508620@news.povray.org...
> 
> > Now, a 180 degrees' roll of this objects makes for a x translation of
> > 3.14159265, if you want it to roll correctly. If I understand your
> > question correctly, you are trying to model the behaviour of, say, an
> > unrolling rug, right? I mean, it moves, rolls, gets smaller, and stays
> > on the ground all at the same time.
> 
> Err, no, just a sphere scaled into an ellipse rolling along. I realise I was wrong
> expecting to be able to rotate 180 degrees in 1 unit, and I should now use 3.141...,
it's
> the vertical position of the centre of the ellipse that I am still unclear
about..how it
> moves down and then back up whilst keeping in contact with the floor. Surely this
value
> will vary depending on the rotation, not the scale of the sphere. Forget that I
mentioned
> changing the scale mid-anim..if I can get this to work as is, then I'll be happy.
> 
> > The y coordinate of the center is -1 + radius.
> >
> > The x coordinate is found by integrating 2*pi*r(clock)*dclock in the
> > range from 0 to clock.
> >
> 
> I'm fairly clear on this
> 
> > Am I getting the problem right? Is this of any help?
> 
> I'm slightly less in the dark, but no-one's switched the floodlights on yet ;-)
> 
> Andy

-- 
 omniVERSE: beyond the universe
  http://members.aol.com/inversez/homepage.htm
 mailto:inv### [at] aolcom?Subject=PoV-News


Post a reply to this message

From: Andrew Cocker
Subject: Re: Math help needed please.
Date: 19 Apr 1999 20:23:44
Message: <371bbb00.0@news.povray.org>
Bob Hughes <inv### [at] aolcom> wrote in message news:371BB225.808E7997@aol.com...
> Ah ha. I was trying to rescale the sphere vertically while rotating and
> keeping it lengthwise in the vertical. Then as it moved across the floor
> it would grow and shrink back again as it moved upward and back down.
> All wrong.
> You needed an ellipse "rolling" along shorter diameter going closer then
> back to starting orientation with the floor. I see now. Maybe.

Yes..you have it ;-)

Here we see the difficulty in solving a problem when it takes this many posts in a
thread
to even ascertain the nature of the problem ;-)

Maybe the fault lies with my explanation. Ah well......

all the best,

Andy


Post a reply to this message

From: Andrew Cocker
Subject: Re: Math help needed please.
Date: 19 Apr 1999 20:25:13
Message: <371bbb59.0@news.povray.org>
Margus Ramst <mar### [at] peakeduee> wrote in message news:371bb1cb.0@news.povray.org...
>
> First, remember that the cirumference of an ellipse is not 2*pi*r. An
> approximation is 2*pi*sqrt[(a^2+b^2)/2] where a and b are lengths of major
> and minor axes.
>
> The other value you want - I haven't got right now. But why not just do
> this: use the Superpatch's trace() function; trace a line from the centre
> straight down. You can now get the radius for the current angle.
>
> Basically like this:
>
> #declare Ellipse=sphere{0,1 scale <.25,1,.25> rotate z*clock*360}
> #declare Rad=trace(Ellipse,0,-y).y;
>
> At least I think this should work.

Thanks Margus,

I was hoping to avoid using the superpatch....I'm not at all familiar with the trace
function. But I will give it a go and see how I get on.

Andy


Post a reply to this message

From: Margus Ramst
Subject: Re: Math help needed please.
Date: 19 Apr 1999 20:38:54
Message: <371bbe8e.0@news.povray.org>
Andrew Cocker wrote in message <371bbb59.0@news.povray.org>...
>
>I was hoping to avoid using the superpatch....I'm not at all familiar with
the trace
>function. But I will give it a go and see how I get on.
>


trace() is really quite simple yet very powerful. I think you will grow to
love it.

Margus


Post a reply to this message

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

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