// Trim mesh A (m_VA and m_FA) with solid B (m_VB and m_FB)
igl::copyleft::cgal::trim_with_solid(
m_VA, m_FA // input: mesh A
, m_VB, m_FB // input: solid B
, m_V, m_F, m_D, m_J // output
);
处理输出:
// Loop over output vertex data
for (int i = 0; i < m_V.rows(); ++i) {
// Access all the vertex data
}
// Loop over output triangle (face) data
for (int i = 0; i < m_F.rows(); ++i) {
// Condition to decide if facet is inside or outside the solid B
if (m_D.coeff(i)) {
// The output face is outside the solid B
} else {
// The output face is inside the solid B
}
}
结果很好
有时修剪结果很好。就像这个用实心圆柱体修剪茶壶模型的模型:
结果不好
但有时修剪结果并不像预期的那样:
如上面的线框视图所示,茶壶和圆柱体的交点被正确识别。但由于某种原因,此循环无法检测到圆柱体外部的三角形:
// Loop over output triangle (face) data
for (int i = 0; i < m_F.rows(); ++i) {
// Condition to decide if facet is inside or outside the solid B
if (m_D.coeff(i)) {
// Face is outside the solid B
} else {
// Face is inside the solid B
}
}
有人知道我可能缺少什么吗?