|
|
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
|
|