POV-Ray : Newsgroups : povray.general : Spline Sweep / While: The Tragedy of the Last Comma : Re: Spline Sweep / While: The Tragedy of the Last Comma Server Time
26 Apr 2024 13:47:07 EDT (-0400)
  Re: Spline Sweep / While: The Tragedy of the Last Comma  
From: clipka
Date: 24 Feb 2018 04:39:01
Message: <5a9132b5$1@news.povray.org>
Am 23.02.2018 um 21:50 schrieb Sven Littkowski:
> What smart ways do you know of, to add or not add the comma for each
> spline sweet element but the last one?
> 
> This is what I tried, but I fail...
> ----------------------
> 
> sphere_sweep
> {
>  b_spline
>  MySegmentAmount,
>  #while (MyCount <= MySegmentAmount)
>   #if(MyCount=MySegmentAmount)
>    #declare MyComma="";

You could use

     #macro MyComma() #end

>   #else
>    #declare MyComma=",";

     #macro MyComma() , #end

>   #end
>   < MyX, MyY, MyZ >, 0.35 MyComma

                            MyComma()

>   #declare MyY             = MyY+MyVMovement;
...

However, it would be much easier to use

    sphere_sweep {
      b_spline
      MySegmentAmount // no comma here!
      #while (...)
        ...
        , <MyX, MyY, MyZ>, 0.35
        ...
      #end
      ...
    }

Also, modern versions do allow a "dangling" comma by now:

    #version 3.71;
    sphere_sweep {
      b_spline
      MySegmentAmount,
      #while (...)
        ...
        <MyX, MyY, MyZ>, 0.35,
        ...
      #end
      ...
    }


Post a reply to this message

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