|
|
In article <40b71634@news.povray.org>,
Kaveh Bazargan <kav### [at] delete_thisfocalimagecom> wrote:
> I think there is a fundamental point here about macro arguments which I
> need to learn. Why is segments zero in the line marked "//the back"?
> Any pointers welcome.
Because you set it to 0 in the loop in sofa_seat(). Variables are passed
"by reference", the macro can modify its parameters. Use something more
like this:
#macro Sofa_Seat(Cushion_wd, Segments) //calls Cushion
union{
#local Segs = Segments;
#while (Segs > 0)
object {Cushion(Cushion_wd, Cushion_dp, Cushion_ht)
translate (Segs-1)*Cushion_wd*x}
#local Segs = Segs - 1;
#end //while
}
#end //macro Sofa_Seat
Notice I made some naming changes...you should always use at least one
capitalized letter in variable names in POV. Unlike other programming
languages, the POV-Ray language has frequent additions, and doing so
will avoid any problems with name conflicts. For example, a POV 3.1
scene using the word "size" for a variable will not work with current
versions, which use that word in the facets pattern. Keywords can be
relied on to always be lower case.
--
Christopher James Huff <cja### [at] earthlinknet>
http://home.earthlink.net/~cjameshuff/
POV-Ray TAG: <chr### [at] tagpovrayorg>
http://tag.povray.org/
Post a reply to this message
|
|