How do I generate Bezier Curves and NURBS in C++ and import it as an igs?

162 Views Asked by At

I am new to C++ NURBS libary. I learnt generating line (by CLine, from nurbs.h ) and save it as igs. But in case of multiple control points, how to generate a curve ? Every other tutorial using graphics.h (putpixel), but couldnt find anything about igs. This should be a simple problem. But I have no idea which function can help me here. Thanks in advance.

We have 4 control points here to begin with.

for (float t = 0.0; t <= 1.0; t += 0.2) {
     double xt = 0.0, yt = 0.0;
     xt = pow(1 - t, 3) * x[0] + 3 * t * pow(1 - t, 2) * x[1] + 3 * pow(t, 2) * (1 - t) * x[2]
     + pow(t, 3) * x[3];
     yt = pow(1 - t, 3) * y[0] + 3 * t * pow(1 - t, 2) * y[1] + 3 * pow(t, 2) * (1 - t) * y[2]
     + pow(t, 3) * y[3];
     count = count + 1;
     //Math::Vector4f c(xt, yt, 0);
     for (int i = 1; i < 3; i++) {
                     listt[i][0]= xt;
                     listt[i][1]= yt;
                     Math::Vector4f a(listt[i][0], listt[i][1],0);
                     myvector.push_back (&a);
                 }
 }

......

.....
igs.Write("test.igs");



--- This is to create the points, but after that I dont know how to use the points to create a Bezier curve .

0

There are 0 best solutions below