POV-Ray : Newsgroups : povray.general : How can I iterate a function in POV script? Server Time
1 Nov 2024 19:14:15 EDT (-0400)
  How can I iterate a function in POV script? (Message 1 to 7 of 7)  
From: Matt
Subject: How can I iterate a function in POV script?
Date: 22 Jul 1999 09:26:38
Message: <37971CCA.D82E4763@spherica.demon.co.uk>
Greetings ;>  Can anyone help me please -   ( POVray 3.00e, Pentium PC
system)

In order to create a number of intertwined same-axis spirals, I think I
need to be able to call a small block of POV script several times from
within the same file if possible. What's the closest I can get to an old
'GOSUB'-type or PROC command?

The BBC BASIC equivalent of what I want to do would be:
---------------------------
FOR i = 1 to 4
PROC spiral
NEXT i
END

DEF PROC spiral
{define a 3d spiral here, properties of which depend on value of i. Code
contains loops, #define's, etc. as well as shape commands}
ENDPROC
---------------------------
So, how can I do this? I thought of #declaring the spiral routine first
and then calling it a few times later, but it won't let me include other
logic & directives with shape commands, apparently. Help!

Best wishes to you all

Matt Rhys-Roberts
North Wales


Post a reply to this message

From: Chris Huff
Subject: Re: How can I iterate a function in POV script?
Date: 22 Jul 1999 09:32:05
Message: <37971D5A.F19063CA@compuserve.com>
You want the #macro directive and the #while directive

#macro ThisIsAMacro(aParameter, anotherParameter)

blahblah

#end//end of macro


#declare counterA = 0;
#while(counterA < 15)
    ThisIsAMacro(counterA, < 0, 4, 2>)
    #declare counterA = counterA + 1;
#end//end of while loop


Post a reply to this message

From: Chris Huff
Subject: Re: How can I iterate a function in POV script?
Date: 22 Jul 1999 09:33:05
Message: <37971D97.116A6A3B@compuserve.com>
Oh, I just saw the version of POV-Ray you are using. You should upgrade
to 3.1g, the latest version.


Post a reply to this message

From: Matt
Subject: Re: How can I iterate a function in POV script?
Date: 22 Jul 1999 09:55:30
Message: <3797238E.C76FDB9F@spherica.demon.co.uk>
Thanks Chris: that's the fastest response I've ever had to a news-type
question!
I'll save up my phone money to download the latest version, and then try
out the #macro command.

Cheers

Matt.


Chris Huff wrote:

> Oh, I just saw the version of POV-Ray you are using. You should upgrade
> to 3.1g, the latest version.


Post a reply to this message

From: Marc Schimmler
Subject: Re: How can I iterate a function in POV script?
Date: 22 Jul 1999 10:05:02
Message: <3797250D.95D3761D@ica.uni-stuttgart.de>
Matt wrote:
> 
> Greetings ;>  Can anyone help me please -   ( POVray 3.00e, Pentium PC
> system)
> 
> In order to create a number of intertwined same-axis spirals, I think I
> need to be able to call a small block of POV script several times from
> within the same file if possible. What's the closest I can get to an old
> 'GOSUB'-type or PROC command?
> 
> The BBC BASIC equivalent of what I want to do would be:
> ---------------------------
> FOR i = 1 to 4
> PROC spiral
> NEXT i
> END
> 
> DEF PROC spiral
> {define a 3d spiral here, properties of which depend on value of i. Code
> contains loops, #define's, etc. as well as shape commands}
> ENDPROC
> ---------------------------
> So, how can I do this? I thought of #declaring the spiral routine first
> and then calling it a few times later, but it won't let me include other
> logic & directives with shape commands, apparently. Help!
> 
> Best wishes to you all
> 
> Matt Rhys-Roberts
> North Wales

Hi Matt!

In 3.0 you still could #include the same include file with different
declarations (see my gear include file example 
http://www.ica.uni-stuttgart.de/~marc/gearex.htm ).

Macros are better! :-)

Marc
-- 
Marc Schimmler


Post a reply to this message

From: Bob Hughes
Subject: Re: How can I iterate a function in POV script?
Date: 22 Jul 1999 13:25:03
Message: <379753BF.945B8F03@aol.com>
The #while loop alone should work out okay. Just exampling below:

#declare S1 = 0  //use as many as you need of these to use on Spiral
#declare S2 = 1  //etcetera
#declare C = 0
#while (Count < 9)  //same as FOR i = 1 to 9
//put Spiral code here or use the inc file, with all the loop
manipulated parts
#declare S3 = S1+C  //whatever.
#declare C = C + 1 //or whatever. clock based value, anything...reaching
9
#include "Spiral.inc"  //alternatively use this
#end  //NEXT until loop reaches 9



Matt wrote:
> 
> Greetings ;>  Can anyone help me please -   ( POVray 3.00e, Pentium PC
> system)
> 
> In order to create a number of intertwined same-axis spirals, I think I
> need to be able to call a small block of POV script several times from
> within the same file if possible. What's the closest I can get to an old
> 'GOSUB'-type or PROC command?
> 
> The BBC BASIC equivalent of what I want to do would be:
> ---------------------------
> FOR i = 1 to 4
> PROC spiral
> NEXT i
> END
> 
> DEF PROC spiral
> {define a 3d spiral here, properties of which depend on value of i. Code
> contains loops, #define's, etc. as well as shape commands}
> ENDPROC
> ---------------------------
> So, how can I do this? I thought of #declaring the spiral routine first
> and then calling it a few times later, but it won't let me include other
> logic & directives with shape commands, apparently. Help!
> 
> Best wishes to you all
> 
> Matt Rhys-Roberts
> North Wales

-- 
 omniVERSE: beyond the universe
  http://members.aol.com/inversez/homepage.htm
 mailto://inversez@aol.com?Subject=PoV-News


Post a reply to this message

From: Matt Giwer
Subject: Re: How can I iterate a function in POV script?
Date: 9 Aug 1999 05:18:19
Message: <37AE9CDE.72D24200@giwersworld.org>
Matt wrote:

> The BBC BASIC equivalent of what I want to do would be:
> ---------------------------
> FOR i = 1 to 4
> PROC spiral
> NEXT i
> END

	WHILE loop is used. The increment has to be stated. Very C like.


Post a reply to this message


Attachments:
Download 'us-ascii' (1 KB)

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