Drawing a smooth curve between 3 points

Hi,

There are many solutions. Someone can use a Lagrange interpolation, someone can use the Newton's

formula:

y = (x-x1)(x-x2) y3 /( (x3-x1)(x3-x2) )

+

y1 (x-x2) (x-x3) /( (x1-x2)(x1-x3) )

+

(x-x1) y2 (x-x3) / ((x2-x1)(x2-x3))

' mathematical notation.

It is easily expandable to n points, but that easily become chaotic (with large oscillations).

The Lagrange's formula is a little bit more stable, but here, only valid for 3 point"s:

y= a0 + a1*x + a2*x^2

' vb/vba notation.

If we assume the three (known) points are at x=-1, x=0 and x=1, with values yn, y0 and y1, then

a0= y0

a2= 0.5*((y1-y0)+(yn-y0))

a1=0.5*((y1-y0)-(yn-y0))

You can also use a Hermite's Interpollation, if you know points and tangeant (rather than just

points). That insure a continuity of the tangeant of the curve. DirectX can help you, this time,

since it supplies many functions like D3DXVec2Hermite (see help file).

Hoping it may help,

Vanderghast, Access MVP

Quote:

> Hi,

> I would like to draw a curve connecting 3 points using

> directx 9. I will appreciate any help with code in vb.net

> or C#

> Thanks