R – How to create a simple 2D NURBS using XAML

.net-3.5beziernetwpfxaml

I need to create a spline with two endpoints and 'n' control points.
As far as I am aware, a Bezier curve allows for only one control point, and a Bezier spline allows for two control points. However, I need to be able to add as many control points as I see fit, not limited to one or two.

Here is an example of what I want to achieve, with 4 control points:
(Source: Wikipedia article on 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

<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>

Best Answer

Not out of the box but take a look at this previous question it will point you to how to draw NURBS using c#, you can then turn the code into something then implements PathSegment to used it under WPF.