Mesh: refactor MeshPy::getSelfIntersections

This commit is contained in:
wmayer
2022-08-04 10:34:49 +02:00
parent 3db79c907c
commit 9b8cf02aaf
3 changed files with 41 additions and 10 deletions

View File

@@ -1043,19 +1043,19 @@ PyObject* MeshPy::getSelfIntersections(PyObject *args)
return nullptr;
std::vector<std::pair<FacetIndex, FacetIndex> > selfIndices;
std::vector<std::pair<Base::Vector3f, Base::Vector3f> > selfPoints;
MeshCore::MeshEvalSelfIntersection eval(getMeshObjectPtr()->getKernel());
eval.GetIntersections(selfIndices);
eval.GetIntersections(selfIndices, selfPoints);
std::vector<Base::Line3d> selfLines;
selfIndices = getMeshObjectPtr()->getSelfIntersections();
selfLines = getMeshObjectPtr()->getSelfIntersections(selfIndices);
Py::Tuple tuple(selfIndices.size());
if (selfIndices.size() == selfPoints.size()) {
if (selfIndices.size() == selfLines.size()) {
for (std::size_t i=0; i<selfIndices.size(); i++) {
Py::Tuple item(4);
item.setItem(0, Py::Long(selfIndices[i].first));
item.setItem(1, Py::Long(selfIndices[i].second));
item.setItem(2, Py::Vector(selfPoints[i].first));
item.setItem(3, Py::Vector(selfPoints[i].second));
item.setItem(2, Py::Vector(selfLines[i].p1));
item.setItem(3, Py::Vector(selfLines[i].p2));
tuple.setItem(i, item);
}
}