POV-Ray : Newsgroups : povray.general : My macro doesn't work with povray 3.6 Server Time
28 Nov 2024 22:56:50 EST (-0500)
  My macro doesn't work with povray 3.6 (Message 1 to 3 of 3)  
From: saturn
Subject: My macro doesn't work with povray 3.6
Date: 17 Aug 2006 17:00:00
Message: <web.44e4d88ea0d9959b0be83f00@news.povray.org>
Hi guys, I wrote a very simple recursive tree macro that works with povray
3.5 but not 3.6. I'm completely stumped about what the problem is. With
some parameters it works fine on 3.6, but with other parameters it has a
syntax error! Am I doing something wrong or is this a bug in povray? Below
is the error message I get and the macro. I can provide a complete scene
that triggers the problem if that would help.

=== Error Message ===

File: rtree.inc  Line: 49
File Context (5 lines):
                                        0,
                                        (rand(RTreeRand)*90)-45
                                > * (1-BiasFactor)) - (BiasVector *
BiasFactor);
                                object { RTree(CB+1, BranchDepth, NextWidth,
Rot, BranchSpline)
Parse Error: Identifier expected, incomplete function call or spline call
found
 instead.

=== Macro ===

#include "colors.inc"
#include "functions.inc"
#include "math.inc"

#declare RTreeRand = seed(1);

#macro HalfRand ()
        (rand(RTreeRand)-0.5)*3
#end

#macro RTreeSeg (SplineStart, TrunkTop, SplineEnd, SizeStart, SizeEnd)
        sphere_sweep {
                cubic_spline 4,
                SplineStart, SizeStart
                <0, 0, 0>, SizeStart
                TrunkTop, SizeEnd
                SplineEnd, SizeEnd
                tolerance 0.1
        }
#end

#macro RTree (CB, BranchDepth, Width, BiasVector, BranchSpline)
        #local Length = BranchSpline(CB).x;
        #local BranchFactor = BranchSpline(CB).y;
        #local NextWidth = Width*BranchFactor;
        #local BiasFactor = BranchSpline(CB).z;

        #local TrunkTop = <0, Length*(rand(RTreeRand)*0.4+0.8), 0>;

        #local SplineEnd = TrunkTop +
                <HalfRand(), rand(RTreeRand)+1, HalfRand()>;

        #local SplineStart = <HalfRand(), rand(RTreeRand)-1, HalfRand()>;

        #if(CB < BranchDepth)
                union {
                        RTreeSeg(SplineStart, TrunkTop, SplineEnd, Width,
NextWidth)

                        #local BC = 2;
                        #while (BC > 0)
                                #local Rot=(<
                                        (rand(RTreeRand)*90)-45,
                                        0,
                                        (rand(RTreeRand)*90)-45
                                > * (1-BiasFactor)) - (BiasVector *
BiasFactor);
                                object { RTree(CB+1, BranchDepth, NextWidth,
Rot, BranchSpline)
                                        rotate Rot
                                        translate TrunkTop - y*(Width/2)
                                }
                                #local BC=BC-1;
                        #end
                }
        #else
                RTreeSeg(SplineStart, TrunkTop, SplineEnd, Width, NextWidth)
        #end
#end


Post a reply to this message

From: Tim Attwood
Subject: Re: My macro doesn't work with povray 3.6
Date: 18 Aug 2006 21:43:54
Message: <44e66cda@news.povray.org>
> ... I wrote a very simple recursive tree macro that works with povray
> 3.5 but not 3.6. I'm completely stumped about what the problem is. ...

The error is on the line before the recursion call, so yes this is probably
a bug in 3.6, because it should have given a more descriptive error
message. RTree failed after calling itself too many times, there is a limit
to how many times it can recurse.


Post a reply to this message

From: Tim Attwood
Subject: Re: My macro doesn't work with povray 3.6
Date: 18 Aug 2006 22:14:55
Message: <44e6741f$1@news.povray.org>
Also, RTree sends a spline as a parameter to itself,
that's fine, but it creates multiple temporary copies of
the spline, taking up lots of memory if the spline is
large.


Post a reply to this message

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