| 
|  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | i ve read that splines are still in developement but maybe this can help..
i get a parse error when using a spline in a macro
ex :
camera { location <0,2,-2> look_at 0 }
light_source { <-5,30,-10> 1 }
#declare MySpline =
  spline {
    cubic_spline
    -.25, <0,0,-1>
    0.00, <1,0,0>
    0.25, <0,0,1>
    0.50, <-1,0,0>
    0.75, <0,0,-1>
    1.00, <1,0,0>
    1.25, <0,0,1>
  }
#macro mymacro(apoint)
  apoint
#end
sphere { 0,.1 translate mymacro(MySpline(.5)) pigment {color rgb 1}}
gives :
sphere { 0,.1 translate mymacro(MySpline( <----ERROR
Parse Error: Expected ')', ( found instead
however if i add parenthesis it works
sphere { 0,.1 translate mymacro((MySpline(.5))) pigment {color rgb 1}}
pov3.5b1 win2000 athlon 900MHz 256MB
M
Post a reply to this message
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | Mael wrote in message <3b9c87b0$1@news.povray.org>...
>
>sphere { 0,.1 translate mymacro(MySpline( <----ERROR
>Parse Error: Expected ')', ( found instead
This is because POV-Ray comes across the "MySpline", and thinks you are
passing the entire spline to the macro.  Then it finds the parenthesis, and
gets confused.
>however if i add parenthesis it works
>
>sphere { 0,.1 translate mymacro((MySpline(.5))) pigment {color rgb 1}}
This time, POV-Ray finds the parenthesis, and is expecting a number or
vector.  As a result, when it finds the "MySpline", it evaluates the spline
at 0.5, and passes the result to the macro.
Because of the way the POV-Ray parser works, I don't think this behavior can
easily be changed.
--
Mark
Post a reply to this message
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | On Tue, 11 Sep 2001 00:24:22 -0400, Mark Wagner wrote:
>This time, POV-Ray finds the parenthesis, and is expecting a number or
>vector.  As a result, when it finds the "MySpline", it evaluates the spline
>at 0.5, and passes the result to the macro.
>
>Because of the way the POV-Ray parser works, I don't think this behavior can
>easily be changed.
Maybe, maybe not.  It might be possible to fix it without breaking too much.
-- 
#macro R(L P)sphere{L F}cylinder{L P F}#end#macro P(V)merge{R(z+a z)R(-z a-z)R(a
-z-z-z a+z)torus{1F clipped_by{plane{a 0}}}translate V}#end#macro Z(a F T)merge{
P(z+a)P(z-a)R(-z-z-x a)pigment{rgbt 1}hollow interior{media{emission T}}finish{
reflection.1}}#end Z(-x-x.2y)Z(-x-x.4x)camera{location z*-10rotate x*90}
Post a reply to this message
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | Ron Parker wrote in message ...
>On Tue, 11 Sep 2001 00:24:22 -0400, Mark Wagner wrote:
>>This time, POV-Ray finds the parenthesis, and is expecting a number or
>>vector.  As a result, when it finds the "MySpline", it evaluates the
spline
>>at 0.5, and passes the result to the macro.
>>
>>Because of the way the POV-Ray parser works, I don't think this behavior
can
>>easily be changed.
>
>Maybe, maybe not.  It might be possible to fix it without breaking too
much.
Would it also be possible to fix things so that a spline will return a 3D
vector under normal circumstances, but a 5D vector when used in a color?
The spline interpolation code is quite capable of working with 5D vectors.
--
Mark
 Post a reply to this message
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |  |  
|  |  | "Mark Wagner" <mar### [at] gte net> wrote in message
news:3b9ee189@news.povray.org...
> Would it also be possible to fix things so that a spline will return a 3D
> vector under normal circumstances, but a 5D vector when used in a color?
> The spline interpolation code is quite capable of working with 5D vectors.
>
> --
> Mark
Perhaps it would be better to implement this as a macro, ie,
#macro Spline_Cubic(a,b,c,d,t)
 #declare a = a+(b-a)*t;
 #declare b = b+(c-b)*t;
 #declare c = c+(d-c)*t;
 #declare a = a+(b-a)*t;
 #declare b = b+(c-b)*t;
 #declare a = a+(b-a)*t;
 a
#end
This way, it could work with any size vectors.  IIRC, several "features" are
now being included as macros, both for their versatility and the ease of
changing them; this wouldn't be too great an addition, I believe.
...Chambers Post a reply to this message
 |  |  |  |  |  |  |  |  
|  |  |  |  |  |  |  |  |  |