开发者

Lagrange polinom in Visual C++ with OpenGL

How to create and print Lagrange polynomial in Visual C++ with using OpenGL library? Thanks a lot.开发者_如何转开发


There could be different approaches but guess one of the most simple to understand approaches might be something like this:

float f(float x)
{
    // calculate y for f(x) here
    return y;
}

void draw()
{
    glBegin();
    for(float x = 0; x < 10; x += 0.1)
        glVertex(x, f(x), 0);
    glEnd();
}

Please note that there are different ways to draw the graph (e.g. caching everything or passing an array etc.) with different performance culprits and advantages. In my example scaling etc. have to be done outside using view and projection matrix.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜