POV-Ray : Newsgroups : povray.advanced-users : Bi-cubic to cubic spline conversion : Re: Bi-cubic to cubic spline conversion Server Time
2 Nov 2024 07:27:51 EDT (-0400)
  Re: Bi-cubic to cubic spline conversion  
From: David Wilkinson
Date: 27 Jan 2000 19:46:25
Message: <2ap19sgup3bg4345a32f8tv9dpqbn5gubu@4ax.com>
On Wed, 26 Jan 2000 23:56:25 -0700, Bret Slivka <coo### [at] chispnet> wrote:

>Is there away to convert a bicubic, or bezier spline as used in
>illustrator to a cubic spline as used in povray, to make smooth prism or
>lathe objects with contours defined in illustrator-- or any other
>program or spline designer?  I don't know the math behind a cubic spline
>and have been unable to find it on the internet so far. I've noticed the
>behavior of a cubic spline and noticed that it's difficult to make sharp
>corners.. of course, unless you use multiple sections. The problem with
>this is that multiple spline sections would produce a discontinuous
>shape in povray... and I believe that the starting and ending points of
>a prism object are required to be identical. I've resorted to simply
>using a linear aproximation of the bezier spline in the prism which is
>fairly satisfactory.. but it would be nice to know this for future
>reference anyway.

As Thomas Willhalm has already said, bi-cubics are used to define patches, not space
curves, although the boundary curves of these patches are cubics.
.
It is quite easy to use Bezier splines to define smooth curves for use in POV lathe or
prism objects.  The bottle macro that I posted in povray.binaries.scene-files on 21
Dec 99
uses Bezier splines to make the outline of the bottle.  This uses several spline
segments
and as I wanted them to blend I ensured that the slopes at the common end point of two
connected splines were the same.  If I had wanted sharp corners I would have allowed
each
curve to have different slopes at the common point. The real point of using spline
curves
is that they can be used as piecewise curves to approximate to any sort of curve -
with or
without slope discontinuities.

Bezier splines can be used in a prism in exactly the same manner.  You can have a
series
of segments and these can have straight lines, corners and curves. I give a simple
example
below.

I can appreciate your problems in trying to make the output of your spline generator
programs relate to the POV spline, but there may be other spline generators that do
this.
I suggest that you have a look through Ken Tyler's links at
http://www.povray.org/links/

\\ ****** POV source starts.
camera
{ location  <0, 1, -4.0>
  direction 1.5*z
  right     4/3*x
  look_at   <1, 0.5,  0.0>}
light_source { <-60, 60, -30> color rgb 1 }
light_source { <60, 60, -30> color rgb 1 }

// Prism constructed of bezier curves.
// Note.  The second and third points in each bezier segment are control points.
//        They do not necessarily lie on the curve, but are on the tangent to the
//         curve at the adjacent point in that segment.  The length of this tangent
//         affects the curvature of the curve.
  prism {
    bezier_spline
    0,0.2, 28, 
    <0,0> <0.2,0.3> <0.4,0.6> <0.7,0.6>   // 1st segment
    <0.7,0.6> <1.1,0.6> <1.1,1> <1.4, 1>
    <1.4,1> <1.6,1> <1.8,1> <2,1>
    <2,1> <2,0.6> <2,0.4> <2,0>
    <2,0> <1.8,0> <1.6,0> <1.6,0>
    <1.6,0> <1.6,0.5> <1.2,0> <0.8,0>
    <0.8,0> <0.6,0> <0.2,0> <0,0>   // 7th segment
    sturm   // this is usually necessary to ensure no glitches when rendering. 
    pigment { rgb <1,1,0>} 
    rotate -x*110
  }
//***** end of pov source.

----------------------------
dav### [at] cwcomnet
http://www.hamiltonite.mcmail.com
----------------------------


Post a reply to this message

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