POV-Ray : Newsgroups : povray.advanced-users : Create spline : Re: Create spline Server Time
3 Jul 2024 04:30:24 EDT (-0400)
  Re: Create spline  
From: clipka
Date: 3 Mar 2009 08:00:00
Message: <web.49ad28c5db4d2f97bdc576310@news.povray.org>
"twister" <twi### [at] o2pl> wrote:
> But my intention is to create a #macro that returns spline by value, not by
> parameter as above. I could then use my #macro in this way:
>
> #declare new_spline = createSpline(myArr, 5);
> //where myArr is an array with points defining a curve

Well, the normal procedure for return-by-value from a macro is this:

#macro MyMacro(foo, bar)
  #declare myReturnValue = ...<something complicated>...
  myReturnValue
#end

I don't see why this shouldn't work for splines, too.


> Question 2: Is there any way (other than using #ifdef command) to check the
> size of an array?

Due to recent discussions, it may not be quite clear what you mean by "size"...

dimension_size(myArray,1) gives you the "official" size of a 1-dimensional
array.

#ifdef(myArray[i]) tests wheter there has actually been a value stored at index
i.

Aside from this, there is nothing. Remember, POV arrays are *not* dynamically
sized; they just might have some elements set to an undefined value (some
"null" value so to speak).


Post a reply to this message

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