https://github.com/libigl/libigl.git
这是几何计算库,可以计算出模型的边界
#define _CRT_SECURE_NO_WARNINGS#include <iostream>#include <igl/boundary_loop.h>#include <igl/list_to_matrix.h>int main(){std::vector<std::vector<int> > Indices;Indices.push_back({ 0, 1, 2 });Indices.push_back({ 1, 3, 2 });Eigen::MatrixXi MatrixI;if (igl::list_to_matrix(Indices, MatrixI)){std::vector<std::vector<int> > Boundarys;igl::boundary_loop(MatrixI, Boundarys);for (const auto& Boundary : Boundarys){for (const auto& Index : Boundary){std::cout << Index << ", ";}}}}
参考 : https://dt.cq.cn/archives/976