Re: BezierCurve vs. BezierFunction
- To: mathgroup at smc.vnet.net
- Subject: [mg118266] Re: BezierCurve vs. BezierFunction
- From: "Christopher O. Young" <cy56 at comcast.net>
- Date: Tue, 19 Apr 2011 06:56:51 -0400 (EDT)
- References: <hjbvdr$2vj$1@smc.vnet.net>
On 1/22/10 6:42 AM, in article hjbvdr$2vj$1 at smc.vnet.net, "Gianluca Gorni"
<gianluca.gorni at dimi.uniud.it> wrote:
>
> I am a total beginner with splines. Playing around BSplines and Bezier curves,
> I noticed that while BSplineCurve and BSplineFunction seemed
> to agree in all the examples I tried, there are differences between the
> output of BezierCurve and BezierFunction. For example, the next two
> graphs are different:
>
> pts = {{0, 0}, {1, 1}, {2, -1}, {3, 0}, {5, 2}, {6, -1}, {7, 3}};
> Graphics[{BezierCurve[pts]}, Axes -> True]
> f = BezierFunction[pts];
> ParametricPlot[f[t], {t, 0, 1}]
>
> Does anybody know of some option settings that make BezierFunction give the
> same curve as BezierCurve?
Specifying SplineDegree -> 6 will give the same result for both cases. It
looks like Mathematica took 5 for the default degree here, for some reason.
Graphics[
{BezierCurve[pts, SplineDegree -> 6]}, Axes -> True
]
f = BezierFunction[pts, SplineDegree -> 6];
To get a table of all the ways of fitting together Bezier curves on these
point, try:
Table[Graphics[
{Green, Line[pts],
Red, Point[pts],
Black,
BezierCurve[pts, SplineDegree -> d]
}
], {d, 1, 6}]
It looks like Mathematica just automatically puts Bezier curves in end-to-end if you use BezierCurve.
>
> Moreover, it is nice that BSplineBasis can be expanded out with
> PiecewiseExpand.
> But then, why don't BezierFunction and BSplineFunction expand out with either
> PiecewiseExpand or FunctionExpand?
>
> pts = {{0, 0}, {1, 1}, {2, -1}, {3, 0}, {4, -2}, {5, 1}};
> f = BezierFunction[pts];
> PiecewiseExpand[f[t]]
> FunctionExpand[f[t]]
>
> Best regards,
> Gianluca Gorni
>
>