#include #include #include int main(int argc,char *argv[]) { using namespace PLib ; char chx[100]; double pos[3]; int it; cerr << "Testing NURBS interpolation and approximation\n" ; Vector_Point3Df points(10) ; for (it=0; it<10; it++) { cin.getline (chx,90); sscanf (chx,"%lf%lf%lf",&pos[0],&pos[1],&pos[2]); points[it] = Point3Df (pos[0],pos[1],pos[2]); cout << "check " << points[it].x() << '\t'; cout << points[it].y() << '\t'; cout << points[it].z() << '\n'; } PlNurbsCurvef curveA,curveB,curveC; curveA.globalInterp(points,3) ; curveB.leastSquares(points,3,5) ; curveC.leastSquares(points,3,8) ; curveA.writePS("tnInterpA.ps",4,2.0) ; curveB.writePS("tnInterpB.ps",4,2.0) ; curveC.writePS("tnInterpC.ps",4,2.0) ; cout << "U1 (knot) = " << curveB.knot() << endl ; cout << "P1 (ctrlPnts)= " << curveB.ctrlPnts() << endl ; cout << "D1 (degree) = " << curveB.degree() << endl ; cout << "U1 (knot) = " << curveC.knot() << endl ; cout << "P1 (ctrlPnts)= " << curveC.ctrlPnts() << endl ; cout << "D1 (degree) = " << curveC.degree() << endl ; cerr << "Done with the interpolation and approximation test.\n" ; }