POV-Ray : Newsgroups : povray.general : Colefax spline head banger : Colefax spline head banger Server Time
29 May 2024 07:08:09 EDT (-0400)
  Colefax spline head banger  
From: Dick Balaska
Date: 1 Dec 2015 05:11:50
Message: <MPG.30c72530390678d0989688@news.povray.org>
I have been using the Colefax spline macro for decades.
I have a new animation spline that gives unexpected results and I can't 
figure out why. (see below)
As I walk through the spline clock, this one iteration reverses 
direction 180 degrees and moves back towards the origin. Then it 
reverses direction again and continues normally, but the damage is done.
By tweaking the spline points, and the loop increment, I can move the 
reversed frame (currently #4 in the code below) but I can't get rid of 
it.  Help?

The interesting output is this.  Note the one y=90 frame.

PushStool: 0.00 StoolVec=<200.00, 1.00, 200.00>
PushStool: 0.00 StoolRot=<0.00, -90.00, 0.00>
PushStool: 0.01 StoolVec=<197.84, 1.00, 200.00>
PushStool: 0.01 StoolRot=<0.00, -90.00, 0.00>
PushStool: 0.02 StoolVec=<195.68, 1.00, 200.00>
PushStool: 0.02 StoolRot=<0.00, -90.00, 0.00>
PushStool: 0.03 StoolVec=<194.36, 1.00, 200.00>
PushStool: 0.03 StoolRot=<0.00, 90.00, 0.00>
PushStool: 0.04 StoolVec=<193.47, 1.00, 200.00>
PushStool: 0.04 StoolRot=<0.00, -90.00, 0.00>
PushStool: 0.05 StoolVec=<191.31, 1.00, 200.00>
PushStool: 0.05 StoolRot=<0.00, -90.00, 0.00>
PushStool: 0.06 StoolVec=<189.15, 1.00, 200.05>
PushStool: 0.06 StoolRot=<0.00, -87.56, 0.00>
PushStool: 0.07 StoolVec=<186.99, 1.00, 200.16>
PushStool: 0.07 StoolRot=<0.00, -86.61, 0.00>
PushStool: 0.08 StoolVec=<184.83, 1.00, 200.30>
PushStool: 0.08 StoolRot=<0.00, -86.26, 0.00>
PushStool: 0.09 StoolVec=<182.68, 1.00, 200.44>
PushStool: 0.09 StoolRot=<0.00, -86.15, 0.00>
PushStool: 0.10 StoolVec=<180.52, 1.00, 200.58>
PushStool: 0.10 StoolRot=<0.00, -86.19, 0.00>



------------ >% code %< ---------------
// splinetest.pov
// with which Colefax's spline macro and I disagree

#include "colors.inc"
#include "splineColefax.inc"

#declare feet=12;
#declare foot=12;
#declare inches=1;
#declare inch=1;

#macro vdebug(vec)
  concat("<", str(vec.x,0,2), ", ",str(vec.y,0,2), ", ", str(vec.z,0,2), 
">")
#end

#declare arrow=
difference {
  box { <-1, -1, -1> <1,1,1> }
  plane { x, 0 rotate y*45 translate x*-1 }
  plane { -x, 0 rotate y*-45 translate x*1 }
  scale 0.2
}

#declare StoolPushStartVec=<200*inches, 1*inch, 200*inches>;
#declare StoolAtCookiesVec=<1*inches, 1*inch, 200*inches>;

#declare stoolToCookiesPathSpline=create_spline(
  array[10]{StoolPushStartVec,
            StoolPushStartVec+<-4*inches, 0, -0*inches>,
            StoolPushStartVec+<-6*inches, 0, -0*inches>,
            StoolPushStartVec+<-9*inches, 0, -0*inches>,
            StoolPushStartVec+<-60*inches, 0, 0>,
            StoolAtCookiesVec+<70*inches, 0, -25*inches>,
            StoolAtCookiesVec+<40*inches, 0, 0>,
            StoolAtCookiesVec+<8*inches, 0, 0>,
            StoolAtCookiesVec+<4*inches, 0, 0>,
            StoolAtCookiesVec}
  create_default_spline + spline_loop (no) + spline_tension (0.2) + 
spline_sampling(100.0)
  )
  //preview_spline (stoolToCookiesPathSpline, spline_preview_pigment
(pigment {Red}))

#local _i=0;
#while (_i<0.1)
  evaluate_spline(stoolToCookiesPathSpline, spline_clock(_i))
  #declare StoolVec=spline_pos;
  #declare StoolRot=spline_heading+<0,0,0>; 
  object {
    arrow
    texture{ pigment{color rgb <1-_i*10/2,0.75+_i*10/4,_i*10>}}
    rotate StoolRot
    translate StoolVec
  }

  #debug concat("PushStool: ", str(_i,0,2), " StoolVec=", vdebug
(StoolVec), "\n")
  #debug concat("PushStool: ", str(_i,0,2), " StoolRot=", vdebug
(StoolRot), "\n")
  #local _i=_i+0.01;
#end
  
  evaluate_spline(stoolToCookiesPathSpline, spline_clock(0.1))
  sphere {
    spline_pos, 0.4
    pigment {Blue}
  }

camera {
    location <StoolPushStartVec.x, 18*inches, StoolPushStartVec.z>+<-10
*inches, 0, 0>
    look_at StoolPushStartVec+<-10*inches, 0, 0>
}
  light_source {  <StoolPushStartVec.x, 38*inches, StoolPushStartVec.z> 
color rgb 1}


Post a reply to this message

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