POV-Ray : Newsgroups : povray.general : How to use a bezier curve in cubic_spline? Server Time: 29 Sep 2020 11:31:34 GMT
 How to use a bezier curve in cubic_spline? (Message 1 to 4 of 4)
 From: Kima Subject: How to use a bezier curve in cubic_spline? Date: 1 Feb 2020 02:15:00 Message:
```In cubic_spline, the beginning and end points are control points, which are
similar to those of a bezier curve. If we take a bezier curve of a semi-circle
with a set of

<-3,0,0>,<-3,4,0>,<3,4,0>,<3,0,0>

The second and third points are the handles, which can be used in a spline as

#declare MySpline =
spline {
cubic_spline
-.25, <-3,4,0> // 2nd point of bezier
0, <-3,0,0> // 1st point of bezier
1, <3,0,0> // 4th point of bezier
1.25, <3,4,0> // 3rd point of bezier
}

#declare ctr = 0;
#while (ctr < 1)
sphere {
MySpline(ctr),.25
pigment { rgb <1-ctr,ctr,0> }
}
#declare ctr = ctr + 0.01;
#end

but it does not work, because I have no mechanism for setting/adjusting the
spline values.
```
 From: Bald Eagle Subject: Re: How to use a bezier curve in cubic_spline? Date: 1 Feb 2020 14:20:01 Message:
```"Kima" <nomail@nomail> wrote:
> In cubic_spline, the beginning and end points are control points, which are
> similar to those of a bezier curve. If we take a bezier curve of a semi-circle
> with a set of

That won't work the way you expect, because POV-Ray doesn't do Bezier splines in
that section of its code.  IIRC, all Bezier splines are cubic splines, but not
all cubic splines are Bezier splines.

I spent a LONG time working with Bezier splines and bicubic patches, and you
usually have to write your own code to do what you want.

> but it does not work, because I have no mechanism for setting/adjusting the
> spline values.

Given your code, I don't exactly know what that means.

User Cousin Ricky has solved this problem for you.
See here:

http://lib.povray.org/searchcollection/index2.php?objectName=SphereSweep&contributorTag=Cousin%20Ricky

:)
```
 From: Kima Subject: Re: How to use a bezier curve in cubic_spline? Date: 1 Feb 2020 14:55:00 Message:
```The link was very handy, and I had not come across it before. Thanks, it helped
a lot.
>
> all Bezier splines are cubic splines, but not
> all cubic splines are Bezier splines.
>

Doesn't this mean that we can use a set of Bezier points as a cubic_spline?
>
> Given your code, I don't exactly know what that means.
>

The bezier points create a perfect semi-circle. But, the above cubic_spline does
not because I gave the values (-0.25, 0, 1, 1.25) randomly.

My question is: how to find these values (-0.25, 0, 1, 1.25) according to the
given bezier points?
```
 From: Bald Eagle Subject: Re: How to use a bezier curve in cubic_spline? Date: 1 Feb 2020 19:00:01 Message:
```"Kima" <nomail@nomail> wrote:

> The bezier points create a perfect semi-circle. But, the above cubic_spline does
> not because I gave the values (-0.25, 0, 1, 1.25) randomly.
>
> My question is: how to find these values (-0.25, 0, 1, 1.25) according to the
> given bezier points?