You are looking at historical revision 19027 of this page. It may differ significantly from its current revision.
A collection of selected algorithms from the Graphics Gems book series. So far the only one implemented is Bezier curve fitting (from the first book).
SRFI-4 for f64vector
The code examples from the book are subject to the following EULA:
<blockquote>The Graphics Gems code is copyright-protected. In other words, you cannot claim the text of the code as your own and resell it. Using the code is permitted in any program, product, or library, non-commercial or commercial. Giving credit is not required, though is a nice gesture. The code comes as-is, and if there are any flaws or problems with any Gems code, nobody involved with Gems - authors, editors, publishers, or webmasters - are to be held responsible. Basically, don't be a jerk, and remember that anything free comes with no guarantee. </blockquote>
Currently the egg does not link with that code: it's possible, and it was implemented that way at first, but now the fit-bezier function has been translated to Scheme, due to some weird malloc/free problem which was hard to pinpoint. Nevertheless, this egg is released under the BSD license since it seems compatible with that EULA.
Thanks to Andrew Glassner for compiling these techniques into a book, and to Philip J. Schneider for this evolution of the curve-fitting algorithm (which was based on some earlier ones).
As of version 1.0, fit-bezier is implemented and working.
In the Graphics Gems example code, a Point is a struct containing x and y as doubles; so a sequence of points would be an array of these structs. However it's possible to cast such an array as simply an array of doubles, and that form is more useful for sending output to graphics APIs such as OpenGL and Quartz. So for this egg a point sequence is an f64vector. Likewise a Bezier curve is represented as an f64vector in which the first 8 numbers are a complete curve segment, then the following curve segment is assumed to have its start point at the previous segment's end point, and therefore it is not repeated. So the first segment has 8 coordinates and the following ones have only 6.
- Takes an f64vector of point coordinates and a tolerance; returns an f64vector with Bezier control points. It will create as many curve segments as necessary to fit the original polyline within the given tolerance.