POV-Ray : Newsgroups : povray.general : Q: Bezier control-point algo? : Re: Q: Bezier control-point algo? Server Time
28 Jul 2024 18:18:04 EDT (-0400)
  Re: Q: Bezier control-point algo?  
From: Stephen Lavedas
Date: 13 Oct 1998 22:54:54
Message: <3624057B.B6DC0E0@Ragingbull.com>
B-patches are interesting in that they have a flatness variable which
increases the curvature as the number goes to zero.  That means that the
curvature formulii change based on the flatness value.  At a flatness of
zero I would assume the curvature would be based on the splines of the
control points.  (Splines are made of groups of 4 control points and so
are B-patches) I don't know which type of spline is used, but I would
guess a Catmull-Rom.  I could be way off base here, so feel free to jump
in a correct me, but if you want to know, the formula for drawing a
spline from the control points (a Catmull-Rom spline) given points
P1,P2,P3,P4 and a variable t for the independant variable is:

P = t^3 * (-0.5 * P1) + t^3 * (1.5 * P2) + t^3 * (-1.5 * P3) + t^3 (0.5
* P4) + t^2 * P1 + t^2 * (-2.5 * P2) + t^2 * (2 * P3) + t^2 * (-0.5 *
P4) + t * (-0.5 * P1) + t * (0.5 * P3) + P2

Now, I did a program (which I haven't clean up and fully release yet)
which takes points from a curve and enters them a B-patch control
points  (and rotates them ,but that isn't necessary) I believe it took
every 12th point from a height field, but really it didn't matter too
much.  The biggest concern is making sure the patches work together
smoothly.  To do so, you must at least overlap the patches by the
edges.  With Splines to ensure that they are smooth, the segments
overlap by three points which means that if you have 5 points (with the
first point being the beginning and end of the line) they you have 5
segments (the first and last point are doubled to make sure the line
connects) I guess that system would be better for bpatches but it would
sure make it take longer to parse.

hope the two ideas help.

Steve


 
Vidar Madsen wrote:
> 
> Hi all.
> 
> I'm writing a small app (is supposed) to spit out bezier
> patches. In that connection I need a quick-n-dirty algorithm
> to determine usable bezier control points based on a curve
> of linear segments. If anyone has source or description of
> such a thing, I'd be grateful if they would share their
> knowledge with me. :-)
> 
> Hopefully this project will turn out to be similar to sPatch
> (but for Linux (or other *nixes)), but don't expect anything
> big quite yet.. ;-)
> 
> TIA!
> 
> Yours,
> Vidar


Post a reply to this message

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