POV-Ray : Newsgroups : povray.advanced-users : On Bezier splines : Re: On Bezier splines Server Time
30 Jul 2024 02:24:18 EDT (-0400)
  Re: On Bezier splines  
From: Tor Olav Kristensen
Date: 2 May 2000 18:09:58
Message: <390F5219.A9E9DC7F@online.no>
Peter Popov wrote:

> A problem arised which requires approximating a Bezier spline with
> linear segments and circle (not ellipse!) arcs. The controlling
> parameters would be maximum number of elements (I know I can
> approximate it with a gazillion segments but I don't want to :) ),
> maximum cusp angle and maximum distance between real and interpolated
> curves. Any math, ideas, headers or urls? Thanks in advance.

Some of my thoughts:

First I think that for optimal results this problem would have to be
solved iteratively.

But if I was to do this in only one pass, then here is my suggestion:

First I would create an array of co-ordinates for several (many)
points along the spline.

I would then "move" along this string of points and for every point
I would calculate how many points "behind" and "in front" of this point
a circle segment could be used for interpolation (within the given
"error" limit).

(The problem here would be to find a way to calculate the centre and
plane and radius for this circle segment in such a way that it comes
near enough as many as possible points around the given point.)
The results of this "walk" along the spline could be stored in another
array.

Then I would do calculations on this array to find out which circle
segments to use in each "area" of the spline. Here the algorithm would
have to take into account your other controlling parameters.
(I think these calculations would be the hardest part of the problem.)

And at last my algorithm would have to patch together all the circle
(or torii ?) segments taking care that every two joined circle segments
have their centres in the same plane and that their "joining" also take
place in the same plane.

There is a danger that this last part of the algorithm would have to
change some of the parameters for the circle segments in order to make
them possible to join smoothly, and thereby enforcing new "iterations"
:(

I think that I would use circle segments with large radii instead of
using linear segments.

I'm not sure what math you are looking for. Please specify.

Tor Olav
--
mailto:tor### [at] hotmailcom
http://www.crosswinds.net/~tok/tokrays.html


Post a reply to this message

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