11 Eigen::Ref<const RowVectors3l> F)
17 assert(F.cols() == 3);
24 std::vector<std::vector<int64_t>> TTT;
26 int64_t vertex_count = F.maxCoeff() + 1;
31 TTT.resize(F.rows() * 3);
32 for (
int t = 0; t < F.rows(); ++t) {
33 for (
int i = 0; i < 3; ++i) {
38 if (x > y) std::swap(x, y);
40 std::vector<int64_t> r(4);
48 std::sort(TTT.begin(), TTT.end());
51 VF = VectorXl::Constant(vertex_count, 1, -1);
52 for (
int i = 0; i < F.rows(); ++i) {
53 for (
int j = 0; j < 3; ++j) {
59 FE.resize(F.rows(), 3);
60 FF.resize(F.rows(), 3);
61 std::vector<int64_t> EF_temp;
66 for (
int i = 0; i < TTT.size(); ++i) {
67 if ((i == (TTT.size() - 1)) || (TTT[i][0] != TTT[i + 1][0]) ||
68 (TTT[i][1] != TTT[i + 1][1])) {
70 EF_temp.push_back(TTT[i][it]);
72 FF(TTT[i][it], TTT[i][ii]) = -1;
73 FE(TTT[i][it], TTT[i][ii]) = EF_temp.size() - 1;
76 EF_temp.push_back(TTT[i][it]);
78 FF(TTT[i][it], TTT[i][ii]) = TTT[i + 1][it];
79 FE(TTT[i][it], TTT[i][ii]) = EF_temp.size() - 1;
81 FF(TTT[i + 1][it], TTT[i + 1][ii]) = TTT[i][it];
82 FE(TTT[i + 1][it], TTT[i + 1][ii]) = EF_temp.size() - 1;
89 EF.resize(EF_temp.size());
90 for (int64_t i = 0; i < EF_temp.size(); ++i) EF(i) = EF_temp[i];
93 return {FE, FF, VF, EF};
const int64_t auto_2d_edges[3][2]
RowVectors< int64_t, 3 > RowVectors3l
VectorX< int64_t > VectorXl
std::tuple< RowVectors3l, RowVectors3l, VectorXl, VectorXl > trimesh_topology_initialization(Eigen::Ref< const RowVectors3l > F)