POV-Ray : Newsgroups : povray.newusers : Splines in macros : Splines in macros Server Time
1 Sep 2024 18:19:17 EDT (-0400)
  Splines in macros  
From: Spock
Date: 9 Feb 2001 11:38:12
Message: <3a841cf4$1@news.povray.org>
Hi,

I wanted to use the spline extensions (as found in MegaPov 0.7) in a macro
but I can't get it to work.  The code below works, but what I really want to
do is initialize the spline based on arguments to the macro (using the
init_3d_spline line that is commented out).  If I comment out the
initialization based on d1,d2,d3,d4 (outside the macro) and try to use the
one based on p1,p2,p3,p4 (inside the macro) instead I get an error: "at
least two knots per spline".

If you have any thoughts on what I am doing wrong I would really appreciate
hearing from you.

Thank you

#version unofficial MegaPov 0.7;

light_source { < 1000, 1000, -1000 > color rgb < 1, 1, 1 > }

camera
{
    location < 0, 0, -10 >
    look_at < 0, 0, 0 >
}

#macro _Hose( p1, p2, p3, p4 )

    //#init_3d_spline { "_spline", p1, p2, p3, p4 }

 union
 {
  sphere { p1 0.1 pigment { rgb < 1, 0, 0 > } }
  sphere { p2 0.1 pigment { rgb < 1, 0, 0 > } }
  sphere { p3 0.1 pigment { rgb < 1, 0, 0 > } }
  sphere { p4 0.1 pigment { rgb < 1, 0, 0 > } }

  #declare c = 0;
  #while ( c < 1 )
    sphere { eval_3d_spline( "_spline", c ), 0.05 }
    #declare c = c + 0.01;
  #end
 }

#end

#declare d1 = < -2, 0, 0 >;
#declare d2 = < -1, 0, 0 >;
#declare d3 = < 1, 1, 0 >;
#declare d4 = < 2, 1, 0 >;

#init_3d_spline { "_spline", d1, d2, d3, d4 }

object
{
 _Hose( d1, d2, d3, d4 )
 pigment { rgb < 1, 1, 1 > }
}


Post a reply to this message

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