本文整理汇总了C++中SurfaceMesh::read方法的典型用法代码示例。如果您正苦于以下问题:C++ SurfaceMesh::read方法的具体用法?C++ SurfaceMesh::read怎么用?C++ SurfaceMesh::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SurfaceMesh
的用法示例。
在下文中一共展示了SurfaceMesh::read方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int /*argc*/, char** argv) {
SurfaceMesh mesh;
mesh.read(argv[1]);
float mean_valence = 0.0f;
unsigned int vertex_valence;
// instantiate iterator and circulators
SurfaceMesh::Vertex_iterator vit;
SurfaceMesh::Vertex_around_vertex_circulator vc, vc_end;
// loop over all vertices
for (vit = mesh.vertices_begin(); vit != mesh.vertices_end(); ++vit) {
// initialize circulators
vc = mesh.vertices(*vit);
vc_end = vc;
// reset counter
vertex_valence = 0;
// loop over all incident vertices
do {
++vertex_valence;
} while (++vc != vc_end);
// sum up vertex valences
mean_valence += vertex_valence;
}
mean_valence /= mesh.n_vertices();
std::cout << "mean valence: " << mean_valence << std::endl;
}
示例2: main
int main(int argc, char** argv) {
QApplication application(argc,argv);
if(argc!=2){
cout << "One argument necessary, given: " << (argc-1) << endl;
return EXIT_FAILURE;
}
SurfaceMesh mesh;
bool ok = mesh.read(argv[1]);
if(!ok){
cout << "could not open file: " << argv[1] << endl;
return EXIT_FAILURE;
}
///--- Preprocess
mesh.triangulate();
mesh.update_vertex_normals();
///--- Shutdown on close GUI
QObject::connect(&application, &QApplication::lastWindowClosed, &application, &QApplication::quit);
Viewer viewer(mesh);
viewer.setWindowTitle("OpenGP/apps/qglviewer");
viewer.show();
return application.exec();
}
示例3: main
int main(int argc, char** argv) {
std::string file = (argc>1) ? argv[1] : "bunny.obj";
SurfaceMesh mesh;
bool success = mesh.read(file);
CHECK(success);
auto points = mesh.get_vertex_property<Vec3>("v:point");
Vec3 p(0,0,0);
for (auto vit: mesh.vertices())
p += points[vit];
p /= mesh.n_vertices();
std::cout << "barycenter: " << p << std::endl;
}
示例4: main
/// Entry point
int main(int argc, char** argv) {
if(argc!=2) mFatal("usage: glfwviewer bunny.obj");
int success = mesh.read(argv[1]);
if(!success) mFatal() << "File not found";
mesh.triangulate();
mesh.update_vertex_normals();
cout << "input: '" << argv[1] << "' num vertices " << mesh.vertices_size() << endl;
cout << "BBOX: " << bounding_box(mesh) << endl;
glfwInitWindowSize(_width, _height);
if (glfwMakeWindow(__FILE__) == EXIT_FAILURE)
return EXIT_FAILURE;
glfwDisplayFunc(display);
glfwTrackball(update_matrices, update_projection_matrix);
init();
glfwMainLoop();
return EXIT_SUCCESS;
}
示例5: main
int main(int argc, char** argv) {
std::string in_file = (argc>1) ? argv[1] : "bunny.obj";
std::string out_file = (argc>2) ? argv[2] : "output.obj";
// instantiate a SurfaceMesh object
SurfaceMesh mesh;
// read a mesh specified as the first command line argument
bool success = mesh.read(in_file);
CHECK(success);
// ...
// do fancy stuff with the mesh
// ...
// write the mesh to the file specified as second argument
mesh.write(out_file);
CHECK(success);
mLogger() << "read:" << in_file << "wrote:" << out_file;
return EXIT_SUCCESS;
}
示例6: main
int main(int /*argc*/, char** argv)
{
SurfaceMesh mesh;
mesh.read(argv[1]);
// get (pre-defined) property storing vertex positions
SurfaceMesh::Vertex_property<Vec3> points = mesh.get_vertex_property<Vec3>("v:point");
SurfaceMesh::Vertex_iterator vit, vend = mesh.vertices_end();
Vec3 p(0,0,0);
for (vit = mesh.vertices_begin(); vit != vend; ++vit)
{
// access point property like an array
p += points[*vit];
}
p /= mesh.n_vertices();
std::cout << "barycenter: " << p << std::endl;
}