We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
问题文件路径 src/geometry/meshedit.cpp
src/geometry/meshedit.cpp
在 meshedit.cpp 文件中的 HalfedgeMesh::EdgeRecord 的重载<运算符函数当前实现如下:
meshedit.cpp
HalfedgeMesh::EdgeRecord
bool operator<(const HalfedgeMesh::EdgeRecord& a, const HalfedgeMesh::EdgeRecord& b) { return a.cost < b.cost; }
该函数会被用于在 std::set<EdgeRecord> edge_queue中对 EdgeRecord 进行排序。然而,当两个 EdgeRecord 对象的 cost 值相等时,由于std::set 要求严格弱序且元素唯一,两个不同edge对应的EdgeRecord对象会被视为相同,可能导致接下来的行为(如对某条edge的EdgeRecord进行erase)不符预期。
std::set<EdgeRecord> edge_queue
在简化cow时,会出现10余条边重复
[Halfedge Mesh] [info] original mesh: 2930 vertices, 5856 faces [Halfedge Mesh] [debug] edges size :8784 edge_queue size :8772
在简化dragon2时,会出现高达20余万条边重复
[Halfedge Mesh] [info] original mesh: 180474 vertices, 360944 faces [Halfedge Mesh] [debug] edges size :541416 edge_queue size :340212
重复的cost值集中在10e-6量级,并非无意义值。
为了解决这个问题,建议修改运算符<重载函数,使其在 cost 相等时比较edge指针:
bool operator<(const HalfedgeMesh::EdgeRecord& a, const HalfedgeMesh::EdgeRecord& b) { if (a.cost != b.cost) { return a.cost < b.cost; } return a.edge < b.edge; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
问题文件路径
src/geometry/meshedit.cpp
问题描述
在
meshedit.cpp
文件中的HalfedgeMesh::EdgeRecord
的重载<运算符函数当前实现如下:该函数会被用于在
std::set<EdgeRecord> edge_queue
中对 EdgeRecord 进行排序。然而,当两个 EdgeRecord 对象的 cost 值相等时,由于std::set 要求严格弱序且元素唯一,两个不同edge对应的EdgeRecord对象会被视为相同,可能导致接下来的行为(如对某条edge的EdgeRecord进行erase)不符预期。问题复现
在简化cow时,会出现10余条边重复
在简化dragon2时,会出现高达20余万条边重复
重复的cost值集中在10e-6量级,并非无意义值。
问题修复
为了解决这个问题,建议修改运算符<重载函数,使其在 cost 相等时比较edge指针:
The text was updated successfully, but these errors were encountered: