本文整理汇总了C++中TriangleMesh::facets_count方法的典型用法代码示例。如果您正苦于以下问题:C++ TriangleMesh::facets_count方法的具体用法?C++ TriangleMesh::facets_count怎么用?C++ TriangleMesh::facets_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TriangleMesh
的用法示例。
在下文中一共展示了TriangleMesh::facets_count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
GLVertexArray::load_mesh(const TriangleMesh &mesh)
{
this->reserve_more(3 * 3 * mesh.facets_count());
for (int i = 0; i < mesh.stl.stats.number_of_facets; ++i) {
stl_facet &facet = mesh.stl.facet_start[i];
for (int j = 0; j <= 2; ++j) {
this->push_norm(facet.normal.x, facet.normal.y, facet.normal.z);
this->push_vert(facet.vertex[j].x, facet.vertex[j].y, facet.vertex[j].z);
}
}
}
示例2: runtime_error
bool
STL::read(std::string input_file, Model* model)
{
TriangleMesh mesh;
if (!STL::read(input_file, &mesh)) return false;
if (mesh.facets_count() == 0)
throw std::runtime_error("This STL file couldn't be read because it's empty.");
ModelObject* object = model->add_object();
object->name = boost::filesystem::path(input_file).filename().string();
object->input_file = input_file;
ModelVolume* volume = object->add_volume(mesh);
volume->name = object->name;
return true;
}
示例3: runtime_error
bool
STL::read(std::string input_file, Model* model)
{
// TODO: encode file name
// TODO: check that file exists
TriangleMesh mesh;
if (!STL::read(input_file, &mesh)) return false;
if (mesh.facets_count() == 0)
throw std::runtime_error("This STL file couldn't be read because it's empty.");
ModelObject* object = model->add_object();
object->name = input_file; // TODO: use basename()
object->input_file = input_file;
ModelVolume* volume = object->add_volume(mesh);
volume->name = input_file; // TODO: use basename()
return true;
}