Zack Weinberg
2008-Oct-10 22:11 UTC
[R] how to evaluate a cubic Bezier curve (B-spline?) given the four control points
I'm trying to use R to determine the quality of a cubic Bezier curve approximation of an elliptical arc. I know the four control points and I want to compute (x,y) coordinates of many points on the curve. I can't find anything in either the base distribution or CRAN that does this; all the spline-related packages seem to be about *fitting* piecewise Bezier curves to a data set. Presumably, internally they have the capability I need, but it doesn't seem to be exposed in a straightforward way. Help?
Greg Snow
2008-Oct-13 16:59 UTC
[R] how to evaluate a cubic Bezier curve (B-spline?) given the four control points
You could look at the xspline function. It approximates b-splines or Bezier curves given control points and shape parameters. It can either plot the spline or return a bunch of point on the curve for comparison to other values. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at imail.org 801.408.8111> -----Original Message----- > From: r-help-bounces at r-project.org [mailto:r-help-bounces at r- > project.org] On Behalf Of Zack Weinberg > Sent: Friday, October 10, 2008 4:11 PM > To: r-help at r-project.org > Subject: [R] how to evaluate a cubic Bezier curve (B-spline?) given the > four control points > > I'm trying to use R to determine the quality of a cubic Bezier curve > approximation of an elliptical arc. I know the four control points > and I want to compute (x,y) coordinates of many points on the curve. > I can't find anything in either the base distribution or CRAN that > does this; all the spline-related packages seem to be about *fitting* > piecewise Bezier curves to a data set. Presumably, internally they > have the capability I need, but it doesn't seem to be exposed in a > straightforward way. Help? > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting- > guide.html > and provide commented, minimal, self-contained, reproducible code.