POV-Ray : Newsgroups : povray.general : How to use a bezier curve in cubic_spline? Server Time
22 Dec 2024 23:53:47 EST (-0500)
  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: 31 Jan 2020 21:15:00
Message: <web.5e34de506de648e8ecc0fada0@news.povray.org>
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.


Post a reply to this message

From: Bald Eagle
Subject: Re: How to use a bezier curve in cubic_spline?
Date: 1 Feb 2020 09:20:01
Message: <web.5e3588a4c348e93e4eec112d0@news.povray.org>
"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


:)


Post a reply to this message

From: Kima
Subject: Re: How to use a bezier curve in cubic_spline?
Date: 1 Feb 2020 09:55:00
Message: <web.5e359126c348e93eecc0fada0@news.povray.org>
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?


Post a reply to this message

From: Bald Eagle
Subject: Re: How to use a bezier curve in cubic_spline?
Date: 1 Feb 2020 14:00:01
Message: <web.5e35ca33c348e93e4eec112d0@news.povray.org>
"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?

http://news.povray.org/povray.general/thread/%3Cweb.5c47356c36095c6fbe7517870%40news.povray.org%3E/

http://news.povray.org/povray.binaries.images/thread/%3Cweb.5da27a2a65c96eb4eec112d0%40news.povray.org%3E/?ttop=428926&
mtop=428668&moff=8

http://news.povray.org/povray.general/thread/%3Cweb.5c407b748844a7763ca35f5e0%40news.povray.org%3E/

http://news.povray.org/povray.binaries.images/thread/%3C5b791075%40news.povray.org%3E/

http://www.povray.org/search/#gsc.tab=0&gsc.q=bezier%20circle&gsc.sort=


Post a reply to this message

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