POV-Ray : Newsgroups : povray.advanced-users : Math help needed please. Server Time
30 Jul 2024 16:18:47 EDT (-0400)
  Math help needed please. (Message 1 to 10 of 40)  
Goto Latest 10 Messages Next 10 Messages >>>
From: Andrew Cocker
Subject: Math help needed please.
Date: 18 Apr 1999 18:41:58
Message: <371a51a6.0@news.povray.org>
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: Ken
Subject: Re: Math help needed please.
Date: 18 Apr 1999 19:49:48
Message: <371A602B.49520542@pacbell.net>
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

Hi Andy,

  While not a definitve answer to your question one of the first examples
given in the animation tutorial section of the Pov-Ray docs provides scripts
showing how to roll a sphere along a floor, have it turn and then come back
halfway. Scaling the object as it rolls would involve subtacting the
difference in size and using it as a function to specify the y translation
component of the objects translate action. While not a super easy thing to
figure out it should not take advanced math functions to get the job done.

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: Andrew Cocker
Subject: Re: Math help needed please.
Date: 18 Apr 1999 21:40:09
Message: <371a7b69.0@news.povray.org>
Ken <tyl### [at] pacbellnet> wrote in message news:371A602B.49520542@pacbell.net...
>
> Hi Andy,
>
>   While not a definitve answer to your question one of the first examples
> given in the animation tutorial section of the Pov-Ray docs provides scripts
> showing how to roll a sphere along a floor, have it turn and then come back
> halfway. Scaling the object as it rolls would involve subtacting the
> difference in size and using it as a function to specify the y translation
> component of the objects translate action. While not a super easy thing to
> figure out it should not take advanced math functions to get the job done.
>

Thanks Ken,

    Yeah, I was aware of that example. I approach all problems like this absolutely
befuddled. Sometimes, after some thought, the answer jumps out at me, but this time it
didn't/hasn't yet. Obviously it's easy to work out the vertical translation at clock
0.5,
as it's the post-scaled radius of the sphere plus the plane's y translation ( in this
case -0.75 ). But I can't get my head round how to work out the amount for clock 0.24
etc.
It's probably really simple.
    I should point out that I haven't even started coding this one yet ( trying to
think
it through first ), and doing so may prod my sleeping brain into ( slothfull ) action.

thanks again,

----------------------
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: Ken
Subject: Re: Math help needed please.
Date: 18 Apr 1999 22:09:36
Message: <371A80F1.7AF191A8@pacbell.net>
Andrew Cocker wrote:
> 
> Ken <tyl### [at] pacbellnet> wrote in message news:371A602B.49520542@pacbell.net...
> >
> > Hi Andy,
> >
> >   While not a definitve answer to your question one of the first examples
> > given in the animation tutorial section of the Pov-Ray docs provides scripts
> > showing how to roll a sphere along a floor, have it turn and then come back
> > halfway. Scaling the object as it rolls would involve subtacting the
> > difference in size and using it as a function to specify the y translation
> > component of the objects translate action. While not a super easy thing to
> > figure out it should not take advanced math functions to get the job done.
> >
> 
> Thanks Ken,
> 
>     Yeah, I was aware of that example. I approach all problems like this absolutely
> befuddled. Sometimes, after some thought, the answer jumps out at me, but this time
it
> didn't/hasn't yet. Obviously it's easy to work out the vertical translation at clock
0.5,
> as it's the post-scaled radius of the sphere plus the plane's y translation ( in
this
> case -0.75 ). But I can't get my head round how to work out the amount for clock
0.24 etc.
> It's probably really simple.
>     I should point out that I haven't even started coding this one yet ( trying to
think
> it through first ), and doing so may prod my sleeping brain into ( slothfull )
action.
> 
> thanks again,
> 
> ----------------------
> Andy

 I would think you simply attach the scaled difference to the clock
function inside the translate statement. If you need this action to
only occur within a certain time frame as you indicate is the case
you can set up the movement of the object for that particular segment
of the clock using #if #else statements. This too is detailed in the
tutorials section of the docs althought the possible uses are not so
well defined for you.
  This is one case where you would benefit from breaking up the movement
into different segments instead of treating it as a function of the entire
clock cycle of 0 - 1.

It would be kind of like this:

 // do nothing between clock 0 - .25
#if MyClock = (clock < .25 )

object { stuff translate <0, 0, 0> }

#else

 //do something between clock .25 - .5
#if MyClock = (clock <= .5 )

object { stuff translate <0, -.25*MyClock, 0> } 

#else

 // do nothing between clock .5 - 1
#if MyClock = (clock > .5 )

object {stuff translate <0, 0, 0> }

#else

  This is the basic idea even if I screwed up the syntax of the example.
See the docs for the correct way to specify it.

 This also gives you the ability to have many different objects performing
differnt actions based on a clock cycle of 0 - 1 but each acting within
a predefined segement of that clock cycle.

 There are users out there that can give better examples than I can.
I have studied the animation process enough that I know it's possibilities
but do so little animation work that I have little practical experience
to provide you with working examples.



-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: Bob Hughes
Subject: Re: Math help needed please.
Date: 18 Apr 1999 22:33:41
Message: <371A87C9.59BD8717@aol.com>
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). However, why not just rotate
-clock*180*z while moving 1*x and use a math function on the scale y.
Without trying it out I don't know exactly what this would be.

sphere {
    <0,0,0>,1
    scale <0.25,H,0.25> //H increases/decreases to keep touch with floor
    translate <-0.5,0,0>
   rotate -clock*180*z  translate clock*x
    texture { MyTexture }
}

plane

    y, -1
    texture { MyTexture }
}

Sound about right anyone? Well, even close then?

-- 
 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: Spider
Subject: Re: Math help needed please.
Date: 18 Apr 1999 22:45:42
Message: <371A89A4.398EDE83@bahnhof.se>
Well, I haven't done animations in POV yet. (I don't need a 4th dimension, I
have my head full with 3.)

>>>>>>>>>>>>Bob Hughes wrote:
<snip>
<remaking>

 
sphere {
  <0,0,0>,1
  scale <0.25,H,0.25> //H increases/decreases to keep touch with floor
  translate <-0.5,0,0>
  translate <0,-H/2,0> /* I think this must be added, 
		    so it will keep in touch with the plane */
  rotate -clock*180*z
  translate clock*x
  texture { MyTexture }
}

> plane {
>
>     y, -1
>     texture { MyTexture }
> }
> 
> Sound about right anyone? Well, even close then?
> 
> --
>  omniVERSE: beyond the universe
>   http://members.aol.com/inversez/homepage.htm
>  mailto:inv### [at] aolcom?Subject=PoV-News

-- 
//Spider
        [ spi### [at] bahnhofse ]-[ http://www.bahnhof.se/~spider/ ]
What I can do and what I could do, I just don't know anymore
                "Marian"
        By: "Sisters Of Mercy"


Post a reply to this message

From: Ken
Subject: Re: Math help needed please.
Date: 18 Apr 1999 23:03:10
Message: <371A8D63.50789135@pacbell.net>
Spider wrote:
> 
> Well, I haven't done animations in POV yet. (I don't need a 4th dimension, I
> have my head full with 3.)
> 
> >>>>>>>>>>>>Bob Hughes wrote:
> <snip>
> <remaking>
> 
> 
> sphere {
>   <0,0,0>,1
>   scale <0.25,H,0.25> //H increases/decreases to keep touch with floor
>   translate <-0.5,0,0>
>   translate <0,-H/2,0> /* I think this must be added,
>                     so it will keep in touch with the plane */
>   rotate -clock*180*z
>   translate clock*x
>   texture { MyTexture }
> }
> 

That was a good catch with the translate being one half of the spheres
scaled difference. If you used the total scale amount you would be
translating for the difference in size of both halfs of the radius.
and end up to 2 times farther that you need to be to stay in contact
with the surface of the plane.

To complete the above example and tie it to the clock try this:

// Assume the shere is 1 and you wand to have finish size of 0.5

  #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 !

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: Ken
Subject: Re: Math help needed please.
Date: 18 Apr 1999 23:05:49
Message: <371A8E1D.AFAC9B51@pacbell.net>
Spider wrote:


>   scale <0.25,H,0.25> //H increases/decreases to keep touch with floor
>   translate <-0.5,0,0>
>   translate <0,-H/2,0> /* I think this must be added,
>                     so it will keep in touch with the plane */
>   rotate -clock*180*z

Remember especialy with animations to rotate then translate or your object
will orbit instead of rotate.

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

From: Spider
Subject: Re: Math help needed please.
Date: 18 Apr 1999 23:06:01
Message: <371A8E66.D0A492AD@bahnhof.se>
Another good point, but wouldn't it be better to calculate the diameter formula
outside the sphere?

That way, you only need to do one change instead of two(I'm talking about the
Diam*0.5 .... lines..)


-- 
//Spider
        [ spi### [at] bahnhofse ]-[ http://www.bahnhof.se/~spider/ ]
What I can do and what I could do, I just don't know anymore
                "Marian"
        By: "Sisters Of Mercy"


Post a reply to this message

From: Ken
Subject: Re: Math help needed please.
Date: 18 Apr 1999 23:11:11
Message: <371A8F60.26C98EED@pacbell.net>
Spider wrote:
> 
> Another good point, but wouldn't it be better to calculate the diameter formula
> outside the sphere?
> 
> That way, you only need to do one change instead of two(I'm talking about the
> Diam*0.5 .... lines..)
> 
> --
> //Spider

You need to remember that scaling in an animation is time dependant and by
using the clock the object will appear to gradualy deminish in size instead
of being seen as an instant change. The translate and the rotate need to be
tied together with a circumference operation to account for the fact
it is rolling as opposed to sitting and spinning but moving too. It's covered
in the docs like I said before. Good example that one.

-- 
Ken Tyler

mailto://tylereng@pacbell.net


Post a reply to this message

Goto Latest 10 Messages Next 10 Messages >>>

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