POV-Ray : Newsgroups : povray.general : Pov -> mesh c.d. Server Time
18 Nov 2024 01:21:33 EST (-0500)
  Pov -> mesh c.d. (Message 1 to 2 of 2)  
From: Rafal 'Raf256' Maj
Subject: Pov -> mesh c.d.
Date: 25 Nov 2002 14:09:38
Message: <Xns92D1CC87C8D32raf256com@204.213.191.226>
Hello,
I need to output my POV-trees to some mesh format.
I quess ther is no tesselating utiity for POV yet ?

Tree is build from cones, so generating mesh is not a problem.

I can write macro like :

#macro SaveCone(Base,R1,Top,R2) 

but the problem is I must now Base,Top,R1,R2 and in current version I do not 
know this parameters exacly, bacause trees are builded like :

#macro Put(Deep)
  #if (Depp>10) cone { 0 .1 y .1 } #end
  object { Put() scale .5  }
  object { Put() translate y scale .5  rotate y*rand(s)*360 }
#end

Any suggestions how can I change this code to get final absolute 
size/positions for cones ?

full source :






#declare StElem=0;
#declare StTree=0;

#declare Seed=seed(2535);
                   
#macro Rand(Min,Max)     
  #local ret = rand(Seed)*abs(Max-Min)+Min;
  (ret)
#end   

#macro BoldFun(Pos)
  #local Ret = clip( 
    pow(
      1.0 * (1-Pos)
      ,.5 )
    
  0,1);
  (Ret)
#end

#macro Put(D,CutOff, Num,Div, Old)
  #local r=.20;
  #local L=1.0;
  #declare Old=clip(Old,0,1);
  
  #if (D>0)
  union {    

    object { // P
      Put(0,0,0,0,Old+.2) scale 1/3*<1,3,1> 
    }    
           
    #local J=Num*Rand(1.0,1.2);       
    #if (D<=CutOff) #local J=1; #end
    #local I=0; #while (I<J)
      object { // B        
        #declare SubPos = L*Rand(.2-Old*.1,.9);
        #declare Bold = BoldFun(SubPos);
        
        Put(D-Rand(0.9, 1.2),CutOff, Num/Div, 1.9, Old+Rand(0.3,0.4))
        
        scale 
        <
          Rand(0.90,1.10),
          Rand(0.80,1.40),
          Rand(0.90,1.10),
        > * <1,1.2,1> * 0.3 * (Bold*.6 +.4)
        
        rotate z*Rand( 
          25,
          45+Old*30
          )
          
        rotate y*Rand(0,360)
        translate y*(SubPos + r*Bold*0.7)
      }
    #local I=I+1; #end  
  }
  #else
    union {
    #declare RThis=r;
    #local LDone=0; #while (LDone<L)
      #declare LThis = Rand(0.1+Old*.7,0.15+Old*.8)*L;
      #declare RNew= clip(r*BoldFun(LDone) ,0,10);
      cone { y*LDone RThis y*(LDone+LThis) RNew }
      #declare RThis=RNew;
    #declare StElem=StElem+1;
    #declare LDone=LDone+LThis; #end
    
    
    }
  #end  
#end  

#macro Tree(Where, Detail)
  #declare StTree=StTree+1;
  object {  
    Put(3,Detail,  16,4 , 0.1) scale 13
    translate Where
  }  
#end


Post a reply to this message

From: ABX
Subject: Re: Pov -> mesh c.d.
Date: 26 Nov 2002 02:45:08
Message: <s796uu8avuvaipd5esgm6hlfqkb4ef5urk@4ax.com>
On 25 Nov 2002 14:09:38 -0500, "Rafal 'Raf256' Maj" <raf### [at] raf256com> wrote:
> I quess ther is no tesselating utiity for POV yet ?

Please, check your guess win search engine over news.povray.org.
For example http://news.povray.org/search/?s=tessel

As for your code: you can usually apply transformations to 3D data and then
create objects without transformations.

ABX


Post a reply to this message

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