void MsInterpolation::test() { while( 1 ) { release_facenode_help(face_root); build_hierarchy_on_face(); printf("最小的节点的点数是:%d\n", min_size_node); int min = 0x7fffffff, max = 0; max_min_height(face_root, min, max); printf("Face min:%d, max:%d\n", min, max); if( max < 15) { break; } } build_registration_pair(); std::cout<<"Build Pair Done!\n"; if( BLENDING ) { pre_blending_process(face_root); std::cout<<"Pre_blending_process Done!\n"; } build_interpolation(face_root, m_mesh, target_mesh, 0.75); MyMesh::VertexIter v_iter, v_end( m_mesh.vertices_end()); for (v_iter = m_mesh.vertices_begin(); v_iter != v_end; ++v_iter) { MyVector3f v = face_root->pts[ v_iter.handle().idx() ]; m_mesh.set_point( v_iter, MyMesh::Point( v[0], v[1], v[2]) ); } write_mesh_data( "interpolation_result.off"); }
int main(int argc, char *argv[]) { int c; struct directory* dp; struct db_i *dbip; /* setup BRL-CAD environment */ bu_setprogname(argv[0]); bu_setlinebuf(stderr); /* process command line arguments */ while ((c = bu_getopt(argc, argv, "vo:ys:fh?")) != -1) { switch (c) { case 'v': verbose++; break; case 'o': out_file = bu_optarg; break; case 'y': yup++; break; case 's': sscanf(bu_optarg, "%f", &scale); break; case 'f': flip_normals++; break; default: print_usage(argv[0]); } } /* param check */ if (bu_optind+1 >= argc) print_usage(argv[0]); /* get database filename and object */ db_file = argv[bu_optind++]; object = argv[bu_optind]; /* open BRL-CAD database */ if ((dbip = db_open(db_file, DB_OPEN_READONLY)) == DBI_NULL) { perror(argv[0]); bu_exit(1, "Cannot open geometry database file %s\n", db_file); } if (db_dirbuild(dbip)) bu_exit(1, "db_dirbuild() failed!\n"); if (verbose) fprintf(stderr, ">> opened db '%s'\n", dbip->dbi_title); /* setup output stream */ if (out_file == NULL) { fp_out = stdout; setmode(fileno(fp_out), O_BINARY); } else { if ((fp_out = fopen(out_file, "wb")) == NULL) { bu_log("Cannot open %s\n", out_file); perror(argv[0]); return 2; } } /* find requested object */ db_update_nref(dbip, &rt_uniresource); dp = db_lookup(dbip, object, 0); if (dp == RT_DIR_NULL) bu_exit(1, "Object %s not found in database!\n", object); /* generate mesh list */ db_functree(dbip, dp, NULL, mesh_tracker, &rt_uniresource, NULL); if (verbose) fprintf(stderr, ">> mesh count: %d\n", mesh_count); /* write out header */ write_header(dbip); /* write out meshes */ write_mesh_data(); /* finish */ dealloc_mesh_list(); db_close(dbip); return 0; }