POV-Ray : Newsgroups : povray.general : Using bezier_spline Server Time
23 Dec 2024 12:46:14 EST (-0500)
  Using bezier_spline (Message 1 to 8 of 8)  
From: Kima
Subject: Using bezier_spline
Date: 23 May 2018 18:30:00
Message: <web.5b05ea92c0e42ed13ce674f0@news.povray.org>
I draw a curvy line with spline in POVRAY as

camera {location <0,15,5> look_at <0,0,0>}
light_source {<0,5,12> color rgb<1,1,1>}
background {color rgb<1,1,1> }

#declare Spline_1 =
  spline {
   cubic_spline
  -.2, <-5,1.0,-5>,
   .1, <-4,1.0,-2>,
   .2, <-3,1.0,3.5>,
   .3, <-2,1.0,2>,
   .4, <-1,1.0,-1>,
   .5, <0,1.0,0>,
   .6, <1,1.0,1>,
   .7, <2,1.0,0>,
   .8, <3,1.0,1>,
   .9, <4,1.0,0>,
   1.0, <5,1.0,3>,
   1.2, < 6,1.0,5>
  }

 #declare Nr = 0;
 #while (Nr<1)
 sphere{ <0,0,0>,0.27
          texture{ pigment{color rgb <1-Nr/2,0.75+Nr/4,1>}
                  finish {diffuse 0.9 phong 1}
                }
        #declare Tr = Nr * 3;
         translate Spline_1(Nr)
       }

 #declare Nr = Nr + 0.001;
 #end


but bezier_spline is a better option for this sort of curves. However, the usage
of bezier_spline and its controller points is not very clear from the povray
documentation.

How can I use bezier_spline in this example?


Post a reply to this message

From: William F Pokorny
Subject: Re: Using bezier_spline
Date: 24 May 2018 06:18:03
Message: <5b06915b$1@news.povray.org>
On 05/23/2018 06:26 PM, Kima wrote:
> I draw a curvy line with spline in POVRAY as
> 
> camera {location <0,15,5> look_at <0,0,0>}
> light_source {<0,5,12> color rgb<1,1,1>}
> background {color rgb<1,1,1> }
> 
> #declare Spline_1 =
>    spline {
>     cubic_spline
>    -.2, <-5,1.0,-5>,
>     .1, <-4,1.0,-2>,
>     .2, <-3,1.0,3.5>,
>     .3, <-2,1.0,2>,
>     .4, <-1,1.0,-1>,
>     .5, <0,1.0,0>,
>     .6, <1,1.0,1>,
>     .7, <2,1.0,0>,
>     .8, <3,1.0,1>,
>     .9, <4,1.0,0>,
>     1.0, <5,1.0,3>,
>     1.2, < 6,1.0,5>
>    }
> 
>   #declare Nr = 0;
>   #while (Nr<1)
>   sphere{ <0,0,0>,0.27
>            texture{ pigment{color rgb <1-Nr/2,0.75+Nr/4,1>}
>                    finish {diffuse 0.9 phong 1}
>                  }
>          #declare Tr = Nr * 3;
>           translate Spline_1(Nr)
>         }
> 
>   #declare Nr = Nr + 0.001;
>   #end
> 
> 
> but bezier_spline is a better option for this sort of curves. However, the usage
> of bezier_spline and its controller points is not very clear from the povray
> documentation.
> 
> How can I use bezier_spline in this example?
> 
> 

To my knowledge bezier_spline has never been an option of spline {} in 
any official offering. See documentation at : 
http://wiki.povray.org/content/Reference:Spline

There are SDL implementations. See for example the object collection at:

http://lib.povray.org/searchcollection/index.php

and search for the keyword 'sphere_sweep'. Both the PointArrays package 
and the SphereSweep packages which come up in that search have Bezier 
spline support.

Bill P.


Post a reply to this message

From: dick balaska
Subject: Re: Using bezier_spline
Date: 24 May 2018 08:16:38
Message: <5b06ad26$1@news.povray.org>
On 05/23/2018 06:26 PM, Kima wrote:
> I draw a curvy line with spline in POVRAY as
> 

> 
> but bezier_spline is a better option for this sort of curves. However, the usage
> of bezier_spline and its controller points is not very clear from the povray
> documentation.
> 
> How can I use bezier_spline in this example?
> 
> 

I use the Colefax spline macro for all my spline needs.

http://www.oocities.org/siliconvalley//lakes/1434/spline/index.html

-- 
dik
Rendered 328976 of 330000 (99%)


Post a reply to this message

From: lelama
Subject: Re: Using bezier_spline
Date: 24 May 2018 18:00:00
Message: <web.5b0735658fdca69f7a63dc9f0@news.povray.org>
dick balaska <dic### [at] buckosoftcom> wrote:

>
> I use the Colefax spline macro for all my spline needs.
>
> http://www.oocities.org/siliconvalley//lakes/1434/spline/index.html
>
> --
> dik
> Rendered 328976 of 330000 (99%)



Interesting, thanks. The tension parameter seems useful in some situations.
Would be interesting to get this parameter nativly in povray.

By the way, is it possible to glue splines in povray. By gluing, I mean I have 2
splines, one from points p0 to pn and the second one from points pn to pq. Then
I would like to concatenate the 2 splines and get one spline from p0 to pq that
I could use like a usual spline.


Post a reply to this message

From: lelama
Subject: Re: Using bezier_spline
Date: 24 May 2018 18:20:00
Message: <web.5b073a358fdca69f7a63dc9f0@news.povray.org>
> However, the usage
> of bezier_spline and its controller points is not very clear from the povray
> documentation.
>
> How can I use bezier_spline in this example?

The splines are hard to follow because the doc is spread at various locations.
The page I like is the following one:
 http://www.povray.org/documentation/view/3.7.0/60/

If you know a little bit about bezier splines, it should be clear what povray
does from this page...


Post a reply to this message

From: Alain
Subject: Re: Using bezier_spline
Date: 25 May 2018 16:08:01
Message: <5b086d21@news.povray.org>
Le 18-05-24 à 17:57, lelama a écrit :
> dick balaska <dic### [at] buckosoftcom> wrote:
> 
>>
>> I use the Colefax spline macro for all my spline needs.
>>
>> http://www.oocities.org/siliconvalley//lakes/1434/spline/index.html
>>
>> --
>> dik
>> Rendered 328976 of 330000 (99%)
> 
> 
> 
> Interesting, thanks. The tension parameter seems useful in some situations.
> Would be interesting to get this parameter nativly in povray.
> 
> By the way, is it possible to glue splines in povray. By gluing, I mean I have 2
> splines, one from points p0 to pn and the second one from points pn to pq. Then
> I would like to concatenate the 2 splines and get one spline from p0 to pq that
> I could use like a usual spline.
> 
> 

Yes, in a way.
If the spline is from a sphere_sweep, simply putting them into an union 
will do the trick.

If you want a genuine spline that is the concatenation of two or more 
splines, it's more complex : You need to edit the splines to make a 
single one from the points of the original ones. If you have anything 
else than a linear spline, you need to take care of the control points.


Post a reply to this message

From: Stephen
Subject: Re: Using bezier_spline
Date: 25 May 2018 16:49:21
Message: <5b0876d1$1@news.povray.org>
On 25/05/2018 21:08, Alain wrote:
> Le 18-05-24 à 17:57, lelama a écrit :
>> dick balaska <dic### [at] buckosoftcom> wrote:
>>
>>>
>>> I use the Colefax spline macro for all my spline needs.
>>>
>>> http://www.oocities.org/siliconvalley//lakes/1434/spline/index.html
>>>
>>> -- 
>>> dik
>>> Rendered 328976 of 330000 (99%)
>>
>>
>>
>> Interesting, thanks. The tension parameter seems useful in some 
>> situations.
>> Would be interesting to get this parameter nativly in povray.
>>
>> By the way, is it possible to glue splines in povray. By gluing, I 
>> mean I have 2
>> splines, one from points p0 to pn and the second one from points pn to 
>> pq. Then
>> I would like to concatenate the 2 splines and get one spline from p0 
>> to pq that
>> I could use like a usual spline.
>>
>>
> 
> Yes, in a way.
> If the spline is from a sphere_sweep, simply putting them into an union 
> will do the trick.
> 
> If you want a genuine spline that is the concatenation of two or more 
> splines, it's more complex : You need to edit the splines to make a 
> single one from the points of the original ones. If you have anything 
> else than a linear spline, you need to take care of the control points.


If I remember well. Moray had an object that was a bezier patch that did 
what was required in two dimensions.
I have no idea how they did it.

-- 

Regards
     Stephen


Post a reply to this message

From: Bald Eagle
Subject: Re: Using bezier_spline
Date: 25 May 2018 21:00:01
Message: <web.5b08b1698fdca69f10874a080@news.povray.org>
Stephen <mca### [at] aolcom> wrote:
> On 25/05/2018 21:08, Alain wrote:
> > Le 18-05-24 à 17:57, lelama a écrit :
> >> dick balaska <dic### [at] buckosoftcom> wrote:

> > Yes, in a way.
> > If the spline is from a sphere_sweep, simply putting them into an union
> > will do the trick.
> >
> > If you want a genuine spline that is the concatenation of two or more
> > splines, it's more complex : You need to edit the splines to make a
> > single one from the points of the original ones. If you have anything
> > else than a linear spline, you need to take care of the control points.

Right.  To manipulate truly as one spline, they should be redefined as a single
spline.
If you're just looking to "stick them together" so that they can be manipulated
as the same object, then unioning them together will do that, but you'll have to
think about the alignment.
One will have to be translated into the proper position, if it isn't already
defined that way, and to get the right junction point, you need to look at the
slopes and curvatures, which IIRC is done by matching the first and second
derivatives of the curves.
Way easier to let POV-Ray just handle the raw data points.
I have always found it easier to define an array of points and then use the
array in the spline or sphere-sweep.

> If I remember well. Moray had an object that was a bezier patch that did
> what was required in two dimensions.
> I have no idea how they did it.

POV-Ray has the bicubic patch, which is a Bezier patch, but I've found that the
best results for aligning it would be to have a 3x3 grid of them tethered
together at the edges.
I tried this a while back - really really tried, and didn't succeed.

Perhaps I'll take another stab at it some day.


Post a reply to this message

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