POV-Ray : Newsgroups : povray.advanced-users : Math help needed please. : Re: Math help needed please. GETTING CLOSER Server Time
30 Jul 2024 22:26:58 EDT (-0400)
  Re: Math help needed please. GETTING CLOSER  
From: Josh English
Date: 21 Apr 1999 19:03:24
Message: <371E4AF5.A48DAC62@spiritone.com>
I got even closer! here is the code with copious notes

// basics of the shape and it's scale and rotation values
#declare x_scale = 0.25;
#declare y_scale = 1;
#declare rotation = 185;

// correction value since the atan2 function uses the
// positive x axis at the zero point and this needs the
// negative x azis as the zero point
#declare roff = 90;

// find a point on the edge of the shape based off of the rotation value
#declare centerX = cos(radians(rotation-roff))*x_scale;
#declare centerY = sin(radians(rotation-roff))*y_scale;
#declare p = <centerX,centerY,0>;

// determine the focii of the ellipse so far only allows to be on the y axis
#declare f1 = sqrt( abs( pow(x_scale,2) - pow(y_scale,2) ) );
#declare f2 = -f1;

//make points out of the foci
#declare foci1 = <0,f1,0>-p;
#declare foci2 = <0,f2,0>-p;

// find the angle of lines between p --> f1, and p --> f2
#declare a1 = degrees(atan2(foci1.x,foci1.y));
#declare a2 = degrees(atan2(foci2.x,foci2.y));

// find the bisector of these two angles
#declare a3 = (a1 + a2)/2;// midangle

// draw everyting
plane { y, 0 pigment { checker } }

sphere { <0,0,0> 1 // okay I c
                pigment { radial frequency 8 rotate 90*x}
                scale <x_scale,y_scale,1>
                translate -p // adjust so p is at the origin
                rotate a3*z // rotate to fit on floor
           }


Now for the final trick: Movingit across the floor.

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.