|
|
Hello,
Can anyone help?
I was just figuring out how splines worked in megapov when 3.5 beta1 was
released. I've included some code below using megapov splines. What I
was trying to do was form the shape of a bench using a spline and then
place a piece of bench at each point that the spline was evaluated.
In megapov, all I needed were the positions within the spline and
megapov would go ahead and evaluate it placing each piece of bench
evenly along the spline. But for pov 3.5 I seem to need to know the
'fraction' along the spline for each point's spline parameter in order
to get this even distribution.
I could estimate the parameter value for each position in the spline,
but that seems a little messy given the power that pov can achieve. Is
there a way around this, or something glaringly wrong in my
understanding of the new syntax :-)
Sorry if this is totally the wrong group for this question.
Steve
/*---megapov 0.7 code */
#init_3d_spline {"BenchSpline", <0,0,0>,<10,5,0>,<20,0,0>,
<25,-15,0>,<35,-50,0>,<40,-60,0>,
<51,-60.5,0>,<86,-55,0>,<95,-60,0>,
<102,-75,0>,<100,-80,0>
}
#declare UnitBench =
union {
box {<-0.5,0.25,-0.1>,<0.5,-0.25,0.1>}
cylinder {<-0.5,0.25,0>,<0.5,0.25,0>,0.1}
cylinder {<-0.5,-0.25,0>,<0.5,-0.25,0>,0.1}
}
#declare Bench =
union {
#local cnt = 0;
#while (cnt < 1)
#local OldPos = eval_3d_spline ("BenchSpline", cnt -
1/1000000);
#local NowPos = eval_3d_spline ("BenchSpline", cnt);
#local Norm = 90 + degrees(atan2 (NowPos.y - OldPos.y ,
NowPos.x - OldPos.x));
object {UnitBench scale <1,5,5> rotate <0,90,Norm> translate
NowPos }
#local cnt = cnt + 1/35;
#end
pigment {red 1}
}
Post a reply to this message
|
|