POV-Ray : Newsgroups : povray.general : Bezier Curve to POV Cubic Spline Conversion Server Time
14 Aug 2024 07:20:13 EDT (-0400)
  Bezier Curve to POV Cubic Spline Conversion (Message 1 to 2 of 2)  
From: Anthony C  D'Agostino
Subject: Bezier Curve to POV Cubic Spline Conversion
Date: 17 Feb 1998 18:17:47
Message: <34ea26fd.0@news.povray.org>
I have a precise bezier curve (from Adobe Illustrator) that I want to turn
into a lathe object for POV-Ray.

I know that a cubic spline takes four points to determine the curve.  A
bezier curve also takes four but it doesn't seem to be implemented in the
same way. The main differences are:

* A bezier curve segment has 2 end points and 2 control points.  The curve
doesn't pass through the control points.
* A cubic spline segment has four points; the curve does pass through all 4.

Is there a simple mathematical way to convert the bezier to the spline?
Maybe there is an unofficial POV version that allows lathe objects to be
described with the coordinates of a bezier curve?


---------------------
Anthony C. D'Agostino
sco### [at] csicom
http://ourworld.compuserve.com/homepages/scorpius
Home of the finest ray-traced puzzles rendered with POV-Ray.


Post a reply to this message

From: Jerry Anning
Subject: Re: Bezier Curve to POV Cubic Spline Conversion
Date: 18 Feb 1998 01:36:06
Message: <34EA8144.4D7A8113@dhol.com>
Anthony C. D'Agostino wrote:

> I have a precise bezier curve (from Adobe Illustrator) that I want to
> turn
> into a lathe object for POV-Ray.
>
> I know that a cubic spline takes four points to determine the curve.
> A
> bezier curve also takes four but it doesn't seem to be implemented in
> the
> same way. The main differences are:
>
> * A bezier curve segment has 2 end points and 2 control points.  The
> curve
> doesn't pass through the control points.
> * A cubic spline segment has four points; the curve does pass through
> all 4.
>
> Is there a simple mathematical way to convert the bezier to the
> spline?
> Maybe there is an unofficial POV version that allows lathe objects to
> be
> described with the coordinates of a bezier curve?

To be precise, POV uses Catmull-Rom splines.  To do the conversion,
matrix multiply (in this order) the inverse of the Bezier basis matrix
by the Catmull-Rom basis matrix.  Then matrix multiply (in this order)
the resultant conversion matrix by the Bezier geometry matrix to get the
equivalent Catmull-Rom geometry matrix.  If enough of my brain remains
to have done the calculations correctly, call your four Bezier points
<a.x, a.y, a.z>, <b.x, b.y, b.z>, <c.x, c.y, c.z> and <d.x, d.y, d.z>
with A and D being the endpoints and B and C being the control points.
Then your four Catmull-Rom equivalent points should be:
E = <2*b.x, 2*b.y, 2*b.z>,
F = <-1/3*a.x+2*b.x+1/3*c.x, -1/3*a.y+2*b.y+1/3*c.y,
-1/3*a.z+2*b.z+1/3*c.z>,
G = <1/3*b.x+2*c.x-1/3*d.x, 1/3*b.y+2*c.y-1/3*d.y,
1/3*b.z+2*c.z-1/3*d.z>,
H = <2*c.x, 2*c.y, 2*c.z>

If I screwed it up, try permuting my formulae.  If that does no good,
the info I calculated this from is in Chapter 11 of the second edition
of Computer Graphics Principles and Practice by Foley, vanDam, Feiner
and Hughes, the section on parametric cubic curves.
Good luck.

Jerry Anning
cle### [at] dholcom


Post a reply to this message

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