www.pudn.com > nurbs++3_0_10.zip > thnurbsS.C
#includeint main(){ using namespace PLib ; Matrix_Point3Df pts(5,6) ; int i,j ; for(i=0;i offset(0,0) = HPoint3Df(0,0,1,0) ; } p3 = 0 ; p3 = p->addLevel(2) ; if(p3){ p3->offset(2,2) = HPoint3Df(0,0,0.5,0) ; p3->offset(0,0) = HPoint3Df(0,0,-0.2,0) ; } H.updateLevels() ; cout << "Checking if the control points were updated properly...\n" ; cout << "At level " << H.level() << " : " << H.ctrlPnts()(0,0) << endl ; cout << "At level " << p->level() << " : " << p->ctrlPnts()(0,0) << endl ; cout << "At level " << p3->level() << " : " << p3->ctrlPnts()(0,0) << endl ; cout << "After adding some modifications to the surface.\n" ; cout << "H(0.0,0.0) = " << H(0.0,0.0) << endl ; cout << "H(0.01,0.01) = " << H(0.01,0.01) << endl ; cout << "H(0.0,0.01) = " << H(0.0,0.01) << endl ; cout << "H(0.01,0.0) = " << H(0.01,0.0) << endl ; H.updateLevels() ; cout << "Checking if the control points were updated properly...\n" ; cout << "At level " << H.level() << " : " << H.ctrlPnts()(0,0) << endl ; cout << "At level " << p->level() << " : " << p->ctrlPnts()(0,0) << endl ; cout << "At level " << p3->level() << " : " << p3->ctrlPnts()(0,0) << endl ; cout << "After adding some modifications to the surface.\n" ; cout << "H(0.0,0.0) = " << H(0.0,0.0) << endl ; cout << "H(0.01,0.01) = " << H(0.01,0.01) << endl ; cout << "H(0.0,0.01) = " << H(0.0,0.01) << endl ; cout << "H(0.01,0.0) = " << H(0.01,0.0) << endl ; H.writeVRML("H1.wrl") ; //H.modCp(3,3,H.ctrlPnts()(3,3)+HPoint3Df(0,0,2,0)) ; H.writeVRML("H2.wrl") ; H.write("thnurbsS.nhs") ; PlHNurbsSurfacef H2 ; cerr << "Reading the saved file..." ; if(!H2.read("thnurbsS.nhs") ){ cerr << "EROR READING THE FILE\n" ; } else cerr << "done\n" ; H2.updateLevels() ; H2.writeVRML("H3.wrl") ; cout << "H2(0.0,0.0) = " << H2(0.0,0.0) << endl ; cout << "H2(0.01,0.01) = " << H2(0.01,0.01) << endl ; cout << "H2(0.0,0.01) = " << H2(0.0,0.01) << endl ; cout << "H2(0.01,0.0) = " << H2(0.01,0.0) << endl ; cout << "At level " << H2.level() << " : " << H2.ctrlPnts()(0,0) << endl ; cout << "Max level = " << H2.maxLevel() << endl ; if(H2.firstLevel()){ cout << "H2 patch is set to\n" ; cout << H2.firstLevel()->ctrlPnts() << endl ; } else{ cout << "Bummer, the reading process didn't work properly.\n" ; } cout << "Done.\n" ; return 0 ; }