Hi Bill - thanks for the reply. You're right - perhaps I can derive the math from that fact. My B-Spline code implements the "openness" via the knot vector, but I believe you can achieve the same result by using a periodic spline that repeats the control points instead. I'll give it a shot.<br>
<br><br><div class="gmail_quote">On Mon, Apr 6, 2009 at 11:30 PM, Bill Spitzak <span dir="ltr"><<a href="mailto:spitzak@thefoundry.co.uk">spitzak@thefoundry.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Aren't the end points as though there are 2 b-spline control points at that location? Ie pretend there is one more point before and after the ends of your curve but equal to those points, then do your algorithm.<br>
<br>
Gerald Hansford wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div></div><div class="h5">
Hi - thanks as always to the tremendous team responsible for Cairo - it's an excellent library.<br>
<br>
Does anyone have any experience rendering open, cubic uniform B-Splines using Cairo? I know that it does not have explicit support for B-Splines, but my understanding is that one can derive the series of Bézier splines represented implicity in a B-Spline. In fact I have code that does this for the open & periodic cases for quadratic b-splines, as well as the periodic case for cubic B-Splines. For that, my code looks about like this:<br>
<br>
Vec2f q0, q1, q2, q3;<br>
q0 = ( spline.getControlPoint( 0 ) + spline.getControlPoint( 1 ) * 4.0f + spline.getControlPoint( 2 ) ) / 6.0f;<br>
moveTo( q0 );<br>
int lastPt = ( spline.isLoop() ) ? numPoints : numPoints - 3;<br>
for( int i = 0; i < lastPt; ++i ) {<br>
Vec2f p1 = spline.getControlPoint( ( i + 1 ) % numPoints );<br>
Vec2f p2 = spline.getControlPoint( ( i + 2 ) % numPoints );<br>
Vec2f p3 = spline.getControlPoint( ( i + 3 ) % numPoints );<br>
q1 = p1 * ( 4.0f / 6.0f ) + p2 * ( 2.0f / 6.0f );<br>
q2 = p1 * ( 2.0f / 6.0f ) + p2 * ( 4.0f / 6.0f );<br>
q3 = p1 * ( 1.0f / 6.0f ) + p2 * ( 4.0f / 6.0f ) + p3 * ( 1.0f / 6.0f );<br>
curveTo( q1, q2, q3 );<br>
}<br>
<br>
The trouble comes when I try to address the open cubic case (where the curve passes through the endpoints of the b-spline). All of the literature on the topic which I can actually understand seems to be about the periodic case.<br>
<br>
I know that in the open case, a b-spline with 4 control points exactly maps to the bezier curve with the same control points. Also through experimentation I can tell that the non-end segments of an open b-spline with >= 6 points correspond to the periodic case. However I am still at a loss as to how one would glue all of this information together, and I haven't managed to get deep enough in the relevant math to follow discussions of how knot insertion or blossoming helps me solve this problem.<br>
<br>
Any help from someone experienced in all of this would be *very* much appreciated.<br>
<br>
Thanks in advance...<br>
<br>
<br></div></div>
------------------------------------------------------------------------<br>
<br>
_______________________________________________<br>
cairo mailing list<br>
<a href="mailto:cairo@cairographics.org" target="_blank">cairo@cairographics.org</a><br>
<a href="http://lists.cairographics.org/mailman/listinfo/cairo" target="_blank">http://lists.cairographics.org/mailman/listinfo/cairo</a><br>
</blockquote>
<br>
<br>
-- <br>
Bill Spitzak, Senior Software Engineer<br>
The Foundry, 618 Hampton Drive, Venice, CA, 90291, USA<br>
Tel: +1 310 399-4555 * Fax: +1 310 450-4516 * Web: <a href="http://www.thefoundry.co.uk" target="_blank">www.thefoundry.co.uk</a><br>
The Foundry Visionmongers Ltd * Registered in England and Wales No: 4642027<br>
</blockquote></div><br>