我需要创建一个具有两个端点和“n”个控制点的样条线。
据我所知,贝塞尔曲线仅允许一个控制点,而贝塞尔样条允许两个控制点。但是,我需要能够添加我认为合适的任意数量的控制点,而不仅限于一两个。
Here is an example of what I want to achieve, with 4 control points:
(Source: Wikipedia article on NURBS http://en.wikipedia.org/wiki/NURBS)
So far I've only been able to combine a series of BezierSegments together like this:
http://img297.imageshack.us/img297/3706/bezierpath.png http://img297.imageshack.us/img297/3706/bezierpath.png
<Polyline Stroke="Green" Stretch="Uniform"
Points="0,0 1,2 2,1 3,3 4,3 5,2 6,3 7,2 8,1.75 9,2.5" />
<Path Stroke="Red" Stretch="Uniform">
<Path.Data>
<PathGeometry>
<PathGeometry.Figures>
<PathFigureCollection>
<PathFigure StartPoint="0,0">
<PathFigure.Segments>
<PathSegmentCollection>
<BezierSegment Point1="1,2" Point2="2,1" Point3="3,3" />
<BezierSegment Point1="4,3" Point2="5,2" Point3="6,3" />
<BezierSegment Point1="7,2" Point2="8,1.75" Point3="9,2.5" />
</PathSegmentCollection>
</PathFigure.Segments>
</PathFigure>
</PathFigureCollection>
</PathGeometry.Figures>
</PathGeometry>
</Path.Data>
</Path>