开发者

Lagrange polinom in Visual C++ with OpenGL

开发者 https://www.devze.com 2023-01-31 10:42 出处:网络
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 ap

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

精彩评论

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

关注公众号