add boolean parameter to MeshKernel::AddFacets to disable check for manifold edges of new faces
This commit is contained in:
parent
24793f0d82
commit
f560398f30
|
@ -173,12 +173,29 @@ void MeshKernel::AddFacets(const std::vector<MeshGeomFacet> &rclFAry)
|
|||
Merge(tmp);
|
||||
}
|
||||
|
||||
unsigned long MeshKernel::AddFacets(const std::vector<MeshFacet> &rclFAry)
|
||||
unsigned long MeshKernel::AddFacets(const std::vector<MeshFacet> &rclFAry,
|
||||
bool checkManifolds)
|
||||
{
|
||||
// Build map of edges of the referencing facets we want to append
|
||||
#ifdef FC_DEBUG
|
||||
unsigned long countPoints = CountPoints();
|
||||
#endif
|
||||
|
||||
// if the manifold check shouldn't be done then just add all faces
|
||||
if (!checkManifolds) {
|
||||
unsigned long countFacets = CountFacets();
|
||||
unsigned long countValid = rclFAry.size();
|
||||
_aclFacetArray.reserve(countFacets + countValid);
|
||||
|
||||
// just add all faces now
|
||||
for (std::vector<MeshFacet>::const_iterator pF = rclFAry.begin(); pF != rclFAry.end(); ++pF) {
|
||||
_aclFacetArray.push_back(*pF);
|
||||
}
|
||||
|
||||
RebuildNeighbours(countFacets);
|
||||
return _aclFacetArray.size();
|
||||
}
|
||||
|
||||
this->_aclPointArray.ResetInvalid();
|
||||
unsigned long k = CountFacets();
|
||||
std::map<std::pair<unsigned long, unsigned long>, std::list<unsigned long> > edgeMap;
|
||||
|
@ -316,12 +333,14 @@ unsigned long MeshKernel::AddFacets(const std::vector<MeshFacet> &rclFAry)
|
|||
return _aclFacetArray.size();
|
||||
}
|
||||
|
||||
unsigned long MeshKernel::AddFacets(const std::vector<MeshFacet> &rclFAry, const std::vector<Base::Vector3f>& rclPAry)
|
||||
unsigned long MeshKernel::AddFacets(const std::vector<MeshFacet> &rclFAry,
|
||||
const std::vector<Base::Vector3f>& rclPAry,
|
||||
bool checkManifolds)
|
||||
{
|
||||
for (std::vector<Base::Vector3f>::const_iterator it = rclPAry.begin(); it != rclPAry.end(); ++it)
|
||||
_clBoundBox.Add(*it);
|
||||
this->_aclPointArray.insert(this->_aclPointArray.end(), rclPAry.begin(), rclPAry.end());
|
||||
return this->AddFacets(rclFAry);
|
||||
return this->AddFacets(rclFAry, checkManifolds);
|
||||
}
|
||||
|
||||
void MeshKernel::Merge(const MeshKernel& rKernel)
|
||||
|
|
|
@ -290,7 +290,7 @@ public:
|
|||
* This method might be useful to close gaps or fill up holes in a mesh.
|
||||
* @note This method is quite expensive and should be rarely used.
|
||||
*/
|
||||
unsigned long AddFacets(const std::vector<MeshFacet> &rclFAry);
|
||||
unsigned long AddFacets(const std::vector<MeshFacet> &rclFAry, bool checkManifolds);
|
||||
/**
|
||||
* Adds new points and facets to the data structure. The client programmer must make sure
|
||||
* that all new points are referenced by the new facets.
|
||||
|
@ -306,7 +306,8 @@ public:
|
|||
* @note This method is quite expensive and should be rarely used.
|
||||
*/
|
||||
unsigned long AddFacets(const std::vector<MeshFacet> &rclFAry,
|
||||
const std::vector<Base::Vector3f>& rclPAry);
|
||||
const std::vector<Base::Vector3f>& rclPAry,
|
||||
bool checkManifolds);
|
||||
/**
|
||||
* Adds all facets and referenced points to the underlying mesh structure. The client programmer
|
||||
* must be sure that both meshes don't have geometric overlaps, otherwise the resulting mesh might
|
||||
|
|
|
@ -1337,7 +1337,7 @@ void MeshTopoAlgorithm::FillupHoles(int level, AbstractPolygonTriangulator& cTri
|
|||
addFacets.push_back(*it);
|
||||
}
|
||||
}
|
||||
_rclMesh.AddFacets(addFacets);
|
||||
_rclMesh.AddFacets(addFacets, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -179,7 +179,7 @@ bool MergeExporter::addPartFeat(App::DocumentObject *obj, float tol)
|
|||
std::vector<Data::ComplexGeoData::Facet> aTopo;
|
||||
geoData->getFaces(aPoints, aTopo, tol);
|
||||
|
||||
mesh->addFacets(aTopo, aPoints);
|
||||
mesh->addFacets(aTopo, aPoints, false);
|
||||
if (countFacets == 0)
|
||||
mergingMesh = *mesh;
|
||||
else
|
||||
|
@ -268,7 +268,7 @@ bool AmfExporter::addPartFeat(App::DocumentObject *obj, float tol)
|
|||
std::vector<Data::ComplexGeoData::Facet> aTopo;
|
||||
geoData->getFaces(aPoints, aTopo, tol);
|
||||
|
||||
mesh->addFacets(aTopo, aPoints);
|
||||
mesh->addFacets(aTopo, aPoints, false);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -519,19 +519,22 @@ void MeshObject::addFacets(const std::vector<MeshCore::MeshGeomFacet>& facets)
|
|||
_kernel.AddFacets(facets);
|
||||
}
|
||||
|
||||
void MeshObject::addFacets(const std::vector<MeshCore::MeshFacet> &facets)
|
||||
void MeshObject::addFacets(const std::vector<MeshCore::MeshFacet> &facets,
|
||||
bool checkManifolds)
|
||||
{
|
||||
_kernel.AddFacets(facets);
|
||||
_kernel.AddFacets(facets, checkManifolds);
|
||||
}
|
||||
|
||||
void MeshObject::addFacets(const std::vector<MeshCore::MeshFacet> &facets,
|
||||
const std::vector<Base::Vector3f>& points)
|
||||
const std::vector<Base::Vector3f>& points,
|
||||
bool checkManifolds)
|
||||
{
|
||||
_kernel.AddFacets(facets, points);
|
||||
_kernel.AddFacets(facets, points, checkManifolds);
|
||||
}
|
||||
|
||||
void MeshObject::addFacets(const std::vector<Data::ComplexGeoData::Facet> &facets,
|
||||
const std::vector<Base::Vector3d>& points)
|
||||
const std::vector<Base::Vector3d>& points,
|
||||
bool checkManifolds)
|
||||
{
|
||||
std::vector<MeshCore::MeshFacet> facet_v;
|
||||
facet_v.reserve(facets.size());
|
||||
|
@ -550,7 +553,7 @@ void MeshObject::addFacets(const std::vector<Data::ComplexGeoData::Facet> &facet
|
|||
point_v.push_back(p);
|
||||
}
|
||||
|
||||
_kernel.AddFacets(facet_v, point_v);
|
||||
_kernel.AddFacets(facet_v, point_v, checkManifolds);
|
||||
}
|
||||
|
||||
void MeshObject::setFacets(const std::vector<MeshCore::MeshGeomFacet>& facets)
|
||||
|
|
|
@ -169,11 +169,14 @@ public:
|
|||
//@{
|
||||
void addFacet(const MeshCore::MeshGeomFacet& facet);
|
||||
void addFacets(const std::vector<MeshCore::MeshGeomFacet>& facets);
|
||||
void addFacets(const std::vector<MeshCore::MeshFacet> &facets);
|
||||
void addFacets(const std::vector<MeshCore::MeshFacet> &facets,
|
||||
const std::vector<Base::Vector3f>& points);
|
||||
bool checkManifolds);
|
||||
void addFacets(const std::vector<MeshCore::MeshFacet> &facets,
|
||||
const std::vector<Base::Vector3f>& points,
|
||||
bool checkManifolds);
|
||||
void addFacets(const std::vector<Data::ComplexGeoData::Facet> &facets,
|
||||
const std::vector<Base::Vector3d>& points);
|
||||
const std::vector<Base::Vector3d>& points,
|
||||
bool checkManifolds);
|
||||
void setFacets(const std::vector<MeshCore::MeshGeomFacet>& facets);
|
||||
void setFacets(const std::vector<Data::ComplexGeoData::Facet> &facets,
|
||||
const std::vector<Base::Vector3d>& points);
|
||||
|
|
|
@ -678,7 +678,8 @@ PyObject* MeshPy::addFacets(PyObject *args)
|
|||
}
|
||||
|
||||
PyErr_Clear();
|
||||
if (PyArg_ParseTuple(args, "O!", &PyTuple_Type, &list)) {
|
||||
PyObject *check = Py_True;
|
||||
if (PyArg_ParseTuple(args, "O!|O!", &PyTuple_Type, &list, &PyBool_Type, &check)) {
|
||||
Py::Tuple tuple(list);
|
||||
Py::List list_v(tuple.getItem(0));
|
||||
std::vector<Base::Vector3f> vertices;
|
||||
|
@ -708,7 +709,7 @@ PyObject* MeshPy::addFacets(PyObject *args)
|
|||
faces.push_back(face);
|
||||
}
|
||||
|
||||
getMeshObjectPtr()->addFacets(faces, vertices);
|
||||
getMeshObjectPtr()->addFacets(faces, vertices, PyObject_IsTrue(check) ? true : false);
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
|
|
@ -231,7 +231,7 @@ void MeshFaceAddition::addFace()
|
|||
f._aulPoints[2] = faceView->index[2];
|
||||
std::vector<MeshCore::MeshFacet> faces;
|
||||
faces.push_back(f);
|
||||
mesh->addFacets(faces);
|
||||
mesh->addFacets(faces, true);
|
||||
mf->Mesh.finishEditing();
|
||||
doc->commitTransaction();
|
||||
|
||||
|
|
|
@ -1609,7 +1609,7 @@ void ViewProviderMesh::fillHole(unsigned long uFacet)
|
|||
//add the facets to the mesh and open a transaction object for the undo/redo stuff
|
||||
Gui::Application::Instance->activeDocument()->openCommand("Fill hole");
|
||||
Mesh::MeshObject* kernel = fea->Mesh.startEditing();
|
||||
kernel->addFacets(newFacets, newPoints);
|
||||
kernel->addFacets(newFacets, newPoints, true);
|
||||
fea->Mesh.finishEditing();
|
||||
Gui::Application::Instance->activeDocument()->commitCommand();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user