POV-Ray : Newsgroups : povray.advanced-users : Math help needed please. : Re: Math help needed please. Server Time
30 Jul 2024 22:15:45 EDT (-0400)
  Re: Math help needed please.  
From: Josh English
Date: 20 Apr 1999 15:24:31
Message: <371CC626.25F1AEE2@spiritone.com>
Thank you for such and intersesting challenge... I havne't found a solution but I'm
having fun
trying. I'm closer than I was this morning, tho.

Code:
#declare x_scale = 0.25;
#declare y_scale = 1;
#declare rotation = 45;
#declare roff = 90;

#declare centerX = cos(radians(rotation-roff))*x_scale;
#declare centerY = sin(radians(rotation-roff))*y_scale;

#declare correction = 180+degrees(atan2(centerX,centerY));


plane { y, 0 pigment { checker } }

sphere { <0,0,05> 1
           pigment { radial frequency 8 rotate 90*x}
           scale <x_scale,y_scale,1>
           translate <-centerX,-centerY,0>
           rotate correction*z
           }

The advantage that this code has is that it keeps a point on the origin at all times.
If you
render a movie animating the rotation value from 0 to 180, making it a looping
animation, you
get a good walking motion. I'll post it to .animations (but it's a quicktime movie, I
don't
have mpeg conversion that I trust)
The advantage is that all we need to do next is translate the sphere appropriately
along the x
axis, but it wont be a continual movement. The animation will show this better than I
can
describe, but the horizontal movement is slower when the "top" and "bottom" of the
sphere are
touching, but faster when it rotates near 90 degrees. I did find a page that will
help:
http://www.geom.umn.edu/docs/reference/CRC-formulas/node29.html. As soon as we find a
solid
way to calculate the length of an arc on the sphere. There is a formula for this on
the page,
and I'll have to experiment with it. Once we have this our horizontal movement is
solved.

The disadvantage to this method, as the animation shows, is that part of sphere dips
under the
plane. This is the fault of the correction angle I'm using. It keeps the center of the
sphere
aligned with the y axis, but this doesn't give us the tangent which is what we need.
This
would work for a perfect sphere, but the scaled version requires a different method of
finding
thetangent and the perpidicular to the tangent.

In other words, you have opened up a huge can of worms and I'm looking for another
can. If
somebody else has solved the problem and has done this in an easier way, please post
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

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