POV-Ray : Newsgroups : povray.general : Equally spaced objects along a spline curve Server Time
31 Oct 2024 19:30:05 EDT (-0400)
  Equally spaced objects along a spline curve (Message 1 to 6 of 6)  
From: trulayne
Subject: Equally spaced objects along a spline curve
Date: 1 Jun 2005 20:37:07
Message: <429e54b3$1@news.povray.org>
I am looking for a way to place multiple fixed size objects, of the same 
type, end to end along a spline curve. This is to build a split rail fence 
over  rolling hills. The spline will follow the curve of the landscape. The 
spline usages I have seen utilize time as a factor but I need distance. Any 
help in this area is greatly appreciated.

TIA
Dennis


Post a reply to this message

From: Alain
Subject: Re: Equally spaced objects along a spline curve
Date: 1 Jun 2005 21:46:07
Message: <429e64df$1@news.povray.org>
trulayne nous apporta ses lumieres en ce 2005-06-01 20:37:
> I am looking for a way to place multiple fixed size objects, of the same 
> type, end to end along a spline curve. This is to build a split rail fence 
> over  rolling hills. The spline will follow the curve of the landscape. The 
> spline usages I have seen utilize time as a factor but I need distance. Any 
> help in this area is greatly appreciated.
> 
> TIA
> Dennis 
> 
> 
Replace the clock dependent index with one generated by a while loop.

Alain


Post a reply to this message

From: trulayne
Subject: Re: Equally spaced objects along a spline curve
Date: 1 Jun 2005 22:19:51
Message: <429e6cc7$1@news.povray.org>
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.

Dennis

"Alain" <ele### [at] netscapenet> wrote in message 
news:429e64df$1@news.povray.org...
> trulayne nous apporta ses lumieres en ce 2005-06-01 20:37:
>> I am looking for a way to place multiple fixed size objects, of the same 
>> type, end to end along a spline curve. This is to build a split rail 
>> fence over  rolling hills. The spline will follow the curve of the 
>> landscape. The spline usages I have seen utilize time as a factor but I 
>> need distance. Any help in this area is greatly appreciated.
>>
>> TIA
>> Dennis
> Replace the clock dependent index with one generated by a while loop.
>
> Alain


Post a reply to this message

From: Jim Charter
Subject: Re: Equally spaced objects along a spline curve
Date: 2 Jun 2005 01:39:22
Message: <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

From: trulayne
Subject: Re: Equally spaced objects along a spline curve
Date: 2 Jun 2005 16:17:35
Message: <429f695f$1@news.povray.org>
Thank you, Jim. This is just the right tool for my needs.
Dennis

"Jim Charter" <jrc### [at] msncom> 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

From: Jim Charter
Subject: Re: Equally spaced objects along a spline curve
Date: 3 Jun 2005 10:30:31
Message: <42a06987$1@news.povray.org>
trulayne wrote:
> Thank you, Jim. This is just the right tool for my needs.
> Dennis
;)

And I'm sure you are already designing a recursive macro that will take 
a predefined spline and refine its definition to user-specified 
tolerance for consistency?


Post a reply to this message

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