POV-Ray : Newsgroups : povray.beta-test : splines - documentation and reality : Re: splines - documentation and reality Server Time
30 Jul 2024 04:14:07 EDT (-0400)
  Re: splines - documentation and reality  
From: Mark Wagner
Date: 12 Jan 2002 00:13:16
Message: <3c3fc5ec@news.povray.org>

>documentation says about spline specification
>
>#declare IDENTIFIER =spline { [SPLINE_IDENTIFIER]  [SPLINE_TYPE] ...
>
>So identifier and type are both optional but can be together.
>
>I checked that when spline S1 is declared and I declare spline S2 as
"child" of
>S1 but with different type then type declaration is parsed ok but do
nothing.
>But is is parsed ok so I don't know what is wrong parser, documentation or
>engine. Conversion is definetly possible becouse when I force type in
spline
>calculation instead of definition then it is changed ok.
>Below is test scene.

This should work, and doesn't.  For those of you who are working on the
official source code, the fix is the following changes to Parse_Spline in
express.cpp:

Replace
   EXPECT/*Check for spline identifier*/
     CASE(SPLINE_ID_TOKEN)
       New = Copy_Spline((SPLINE *)Token.Data);
       i = New->Number_Of_Entries;
       EXIT
     END_CASE

     OTHERWISE
       UNGET

       EXIT
     END_CASE
   END_EXPECT

with
   EXPECT/*Check for spline identifier*/
     CASE(SPLINE_ID_TOKEN)
       New = Copy_Spline((SPLINE *)Token.Data);
       i = New->Number_Of_Entries;
       Type = New->Type;
       EXIT
     END_CASE

     OTHERWISE
       UNGET

       EXIT
     END_CASE
   END_EXPECT

and add
   New->Type = Type;
just before the line
return New;

>Working with it I noticed another bug. I can't pass spline
>calculation as macro parameter. To check it uncomment debug line. Works
fine
>when there is parenthesis around spline in call of VStr().


This is a known problem.  I'm fairly sure it is officially classified as a
"feature", and putting parentheses around the spline is the recommended
work-around.

--
Mark


Post a reply to this message

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