POV-Ray : Newsgroups : povray.general : A macro that drops a vector-- what's the syntax again? : A macro that drops a vector-- what's the syntax again? Server Time
1 Aug 2024 10:16:02 EDT (-0400)
  A macro that drops a vector-- what's the syntax again?  
From: Greg M  Johnson
Date: 9 Nov 2005 21:58:46
Message: <4372b765@news.povray.org>
I cannot get the following code to work:

//-----------------------------
#macro sign(a)
#if (a<0)
        (-a)
#else
        (a)
#end
#end


#macro ease_in(your_clock,your_array)
        #local rotdim=dimension_size(your_array,1);
        #local ennn=0;
        #while(ennn<rotdim)                          
                #if(your_array[ennn].x=your_clock)                     
                                
(<your_array[ennn].y,your_array[ennn].z,your_array[ennn].t>)            
                        
                        #declare ennn=ennn+1e7;                        
                #else                        
                        #if(your_array[ennn].x<your_clock) 
                                #local ennn=ennn+1;
                        #else
                                #local why1=your_array[ennn+0];
                                #local why0=your_array[ennn-1]; 
                                #local
teee=(your_clock-why0.x)/(why1.x-why0.x);
                                #local
teeecubes=0.5-0.5*pow(abs(cos(teee*pi)),0.5)*sign(cos(teee*pi));
                                
                                #local
exxx=why0.y+(why1.y-why0.y)*teeecubes;
                                #local
eyyy=why0.z+(why1.z-why0.z)*teeecubes;
                                #local
ezzz=why0.t+(why1.t-why0.t)*teeecubes;
                        
                                #declare ennn=ennn+1e7;  
                                (<exxx,eyyy,ezzz>)                      
                        
                        #end 
                #end
        #end                 
        
#end

#declare ary=array[3]{
//an array of four dimensions:
//< time,  x_position[n], y_position[n], z_position[n]>

<0.00,     -16,47,24>,
<0.50,      0,52,-0>,
<1.00,     -16,47,24>
}

//sorry for the mess here!
#declare ltempwristpt=<0,0,0>+(ease_in(clock,ary));

sphere{ltempwristpt,1 pigment{red 1}}


Post a reply to this message

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