|
![](/i/fill.gif) |
Thank you, Jim. This is just the right tool for my needs.
Dennis
"Jim Charter" <jrc### [at] msn com> wrote in message
news:429e9b8a@news.povray.org...
> trulayne wrote:
>> That would be fine if distance increments along the spline were not
>> critical. I need a way to find equal distances along the spline. Such
>> as...each fence segment needs to be 1 pov unit long....so depending on
>> how long the spline is, the right amount of fence pieces are connected
>> end to end and given the right slope. There will be many such splines
>> over the whole scene of various lengths.
>>
>
>
>
> There are spline macros by Chris Colefax that do this.
>
> Otherwise afaik you need to do this:
>
> You need to estimate the overall length of the spline
>
> Then you need to define the spline such that the weights in
>
> the spline syntax are proportional to the distance along the spline
> that the defining points are relative to the total length.
>
> Then when you walk the spline to place you fence posts the distances will
> be more even.
>
> Obviously it all depends on how well you can approximate these
> proportions.
>
> So...you approximate the length:
> #local Len =
> vlength (P4-P3)
> +vlength (P3-P2)
> +vlenght (P2-P1)
> +vlength (P1-P0);
>
> Then define the spline
> #local Spl =
> spline { natural_spline
> 0/Len P0
>
> vlength(P1-P0)/Len P1
>
> (vlenght(P2-P1)
> +vlength(P1-P0))/Len P2
>
> (vlength (P3-P2)
> +vlenght (P2-P1)
> +vlength (P1-P0))/Len P3
>
> (vlength (P4-P3)
> +vlength (P3-P2)
> +vlenght (P2-P1)
> +vlength (P1-P0))/Len P4
> }
>
> Now constant increments in the arguement should
> get you more constant distances:
>
> #local I=1;
> #while(I<50)
> cylinder { Spl(I/50), Spl((I-1)/50), Radius }
> #local I=I+1;
> #end
>
> This example code is untested but illustrates the principle I mean.
>
> This process then can be used iteratively to refine the approximations and
> improve the consistency
Post a reply to this message
|
![](/i/fill.gif) |