POV-Ray : Newsgroups : povray.advanced-users : Math help needed please. : Re: Math help needed please. Server Time
30 Jul 2024 20:21:10 EDT (-0400)
  Re: Math help needed please.  
From: Josh English
Date: 22 Apr 1999 20:24:07
Message: <371FAF60.B865323@spiritone.com>
I was looking in .animations, not .binaries.animation, so I didn't see your post
until today. (silly me, forgot that group was there).

But I did have an epiphany. I was trying to figure out the arc length when a
ratio of the circumference to 360 degrees compared to the ratio of x to current
angle should give me the proper distance. I'm checking that now but it works.
The only thing I haven't tested is changing the size of the sphere in the middle
of the animation

here is my code:

#version 3.1;

#include "colors.inc"

global_settings { assumed_gamma 1.0 }

// ----------------------------------------


sky_sphere { pigment { gradient y
                       color_map { [0.0 color blue 0.6]
                       [1.0 color rgb 1] } } }

light_source { <0,0,0> color rgb 1
               translate <-30, 30, -30>
              }

// ----------------------------------------
// clock goes from 0 to 1
#declare anim_clock = clock;

#declare x_scale = 0.25;
#declare y_scale = 1;

#declare rotation = anim_clock * 180;   // only animate one half rotation for a
looping anim
#declare roff = 90;

#declare centerX = cos(radians(rotation-roff))*x_scale;
#declare centerY = sin(radians(rotation-roff))*y_scale;
#declare p = <centerX,centerY,0>;

#declare circumference = 2*pi*sqrt(( pow(x_scale,2) + pow(y_scale,2) ) / 2 );
#declare half = circumference / 2;
#declare quarter = circumference / 4;

#declare f1 = sqrt( abs ( pow(x_scale,2) - pow(y_scale,2) ) );
#declare f2 = -f1;

#declare foci1 = <0,f1,0>-p;
#declare foci2 = <0,f2,0>-p;

#declare a1 = degrees ( atan2 ( foci1.x,foci1.y));
#declare a2 = degrees ( atan2 ( foci2.x,foci2.y));
#declare a3 = ( a1 + a2 )/2;

// translate across x axis
#declare translation = circumference *rotation/360;


plane { y, 0 pigment { checker scale quarter } }

sphere { <0,0,0> 1
         pigment { radial frequency 8 rotate 90*x}
         scale <x_scale,y_scale,0.125>
         translate -p
         rotate a3*z
         translate translation*x
         }

camera { location  <translation, y_scale, -3.5>
         angle 65
         right     4/3*x
         look_at   <translation, y_scale,  0.0>
         //orthographic
        }

Margus Ramst wrote:

> Josh English wrote in message <371F3EEC.1DF566CE@spiritone.com>...
> >Thanks, Steve. Luckily I found a method of rolling the scaled sphere, which
> does make an ellipse, around
> >the origin. What I need now is a method for finding the length of an arc on
> an ellipse. I've found
> >equations, but they don'tmake much sense to me. I'm still working on it,
> though. The arc length is the
> >last thing I need to finish the problem.
> >
>
> Why do you need the length af an arc? The tangency point problem was the
> only one I had. If you've solved that, the circumference formula gives the
> forward motion along the ellipse. If you look at my anim, you can see that
> there is no "gliding", the ellipsoid rolls correctly.
>
> Margus


Post a reply to this message

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