本文整理汇总了C++中Polyhedron::write_file_eps方法的典型用法代码示例。如果您正苦于以下问题:C++ Polyhedron::write_file_eps方法的具体用法?C++ Polyhedron::write_file_eps怎么用?C++ Polyhedron::write_file_eps使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polyhedron
的用法示例。
在下文中一共展示了Polyhedron::write_file_eps方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
// 1) Cut the mesh
Seam seam = cut_mesh(mesh_adaptor);
if (seam.empty())
{
std::cerr << "Input mesh not supported: the example cutting algorithm is too simple to cut this shape" << std::endl;
return EXIT_FAILURE;
}
//
// 2) Create adaptor that virtually "cuts" a patch in a Polyhedron_ex mesh
Mesh_patch_polyhedron mesh_patch(mesh_adaptor, seam.begin(), seam.end());
if (!mesh_patch.is_valid())
{
std::cerr << "Input mesh not supported: non manifold shape or invalid cutting" << std::endl;
return EXIT_FAILURE;
}
std::cerr << "Mesh cutting: " << task_timer.time() << " seconds." << std::endl;
task_timer.reset();
//***************************************
// switch parameterization
//***************************************
std::cerr << "Parameterization..." << std::endl;
// Defines the error codes
typedef CGAL::Parameterizer_traits_3<Mesh_patch_polyhedron> Parameterizer;
Parameterizer::Error_code err;
if (solver == std::string("opennl"))
{
err = parameterize<Mesh_patch_polyhedron,
OpenNL::DefaultLinearSolverTraits<double>,
OpenNL::SymmetricLinearSolverTraits<double>
>(mesh_patch, type, border);
}
else
{
std::cerr << "Error: invalid solver parameter " << solver << std::endl;
err = Parameterizer::ERROR_WRONG_PARAMETER;
}
// Report errors
switch(err) {
case Parameterizer::OK: // Success
break;
case Parameterizer::ERROR_EMPTY_MESH: // Input mesh not supported
case Parameterizer::ERROR_NON_TRIANGULAR_MESH:
case Parameterizer::ERROR_NO_TOPOLOGICAL_DISC:
case Parameterizer::ERROR_BORDER_TOO_SHORT:
std::cerr << "Input mesh not supported: " << Parameterizer::get_error_message(err) << std::endl;
return EXIT_FAILURE;
break;
default: // Error
std::cerr << "Error: " << Parameterizer::get_error_message(err) << std::endl;
return EXIT_FAILURE;
break;
};
std::cerr << "Parameterization: " << task_timer.time() << " seconds." << std::endl;
task_timer.reset();
//***************************************
// Output
//***************************************
// get output file's extension
std::string extension = output.substr(output.find_last_of('.'));
// Save mesh
if (extension == ".eps" || extension == ".EPS")
{
// write Postscript file
if ( ! mesh.write_file_eps(output.c_str()) )
{
std::cerr << "Error: cannot write file " << output << std::endl;
return EXIT_FAILURE;
}
}
else if (extension == ".obj" || extension == ".OBJ")
{
// write Wavefront obj file
if ( ! mesh.write_file_obj(output.c_str()) )
{
std::cerr << "Error: cannot write file " << output << std::endl;
return EXIT_FAILURE;
}
}
else
{
std::cerr << "Error: output format not supported" << output << std::endl;
err = Parameterizer::ERROR_WRONG_PARAMETER;
return EXIT_FAILURE;
}
std::cerr << "Write file " << output << ": "
<< task_timer.time() << " seconds " << std::endl;
return EXIT_SUCCESS;
}