POV-Ray : Newsgroups : povray.newusers : Smooth circular rotation using spline : Smooth circular rotation using spline Server Time
3 Feb 2023 14:50:59 EST (-0500)
  Smooth circular rotation using spline  
From: SecondCup
Date: 24 Oct 2016 21:00:05
Message: <web.580eac39d7bd2f98f0b3ab370@news.povray.org>
Hi all,

I'm trying to make my camera rotate around an object in a perfectly smooth
circular manner. The reason I'm having
trouble is that I want the camera to be slow in some parts sections of the
rotation while fast in other parts. I'm no math whizz so I an using the spline
identifiers rather than some complicated trigonometry code. Cubic_spline seems
to work closest (smoothest) to what I want it to do.

Ive used a total of 12 points per rotation so far and the camera still
appears to 'wobble' in
and out toward the centre object. See the code below for the camera path. Is
there an easier way to make the path a smooth circle than just to keep adding in
points on the curve? It gets
tricky splitting the rotation time up into the correct proportions as you add in
more points.

Any suggestions are welcome!

#declare CameraSpline =
    spline {
       smooth_spline

         0.1, <0, 4000,-5000>
        0.15, <2000,4000,-4500>
        0.2, <4500,4000,-2000>
        0.25, <5000, 4000, 0>
        0.275, <4500, 4000, 2000>
        0.3, <2000, 4000, 4500>
        0.325 <0, 4000, 5000>
        0.35, <-2000, 4000, 4500>
        0.38, <-4500, 4000, 2000>
        0.41, <-5000, 4000, 0>
        0.42, <-4500, 4000, -2000>
        0.47, <-2000, 4000, -4500>
        0.50, <0, 4000, -5000>
        0.53, <2000, 4000, -4500>
        0.56, <4500, 4000, -2000>
        0.57, <5000, 4000, 0>
        0.59, <4500, 4000, 2000>
        0.61, <2000, 4000, 4500>
        0.64, <0, 4000, 5000>
        0.66, <-2000, 4000, 4500>
        0.74, <-4500, 4000, 2000>
        0.81, <-5000, 4000, 0>
        0.87, <-4500, 4000, -2000>
        0.91, <-2000, 4000, -4500>
        0.95, <0, 4000, -5000>
        1, <2000, 4000, -4500>
        1.1, <4500, 4000, -2000>

       }


#declare ctr = 0;
#while (ctr < 1)
  sphere {
   CameraSpline(ctr),150
    pigment { rgb <1-ctr,ctr,0> }
  }
  #declare ctr = ctr + 0.001;
#end


Post a reply to this message

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