POV-Ray : Newsgroups : povray.bugreports : VRand_in_Obj function - syntax error Server Time
22 Nov 2024 10:40:07 EST (-0500)
  VRand_in_Obj function - syntax error (Message 1 to 1 of 1)  
From: phil davidson
Subject: VRand_in_Obj function - syntax error
Date: 10 Oct 2001 06:33:09
Message: <3bc423e5@news.povray.org>
there is an error  in the Vrand in Obj function that was provided with the
POV-RAY 3.5 beta 5 release..  the call to VRand_In_Box is improperly
formatted  - Stream value should be last, rather than first.


 the following code works correctly.
philip davidson


//a random point inside an arbitrary object
//Warning: can be quite slow if the object occupies a small
//portion of the volume of it's bounding box!
//Also, will not work on objects without a definite "inside".
#macro VRand_In_Obj(Obj, RS)
    #local Mn = min_extent(Obj);
    #local Mx = max_extent(Obj);
    #local Pt = VRand_In_Box( Mn, Mx, RS);
    #local J = 0;
    #while(inside(Obj, Pt) = 0 & J < 1000)
        #local Pt = VRand_In_Box( Mn, Mx, RS);
        #local J = J + 1;
    #end
    (Pt)
#end


Post a reply to this message

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