Mesh: define the typenames FacetIndex and PointIndex to distinguish between facet and point related indexes

This commit is contained in:
wmayer
2021-09-14 23:01:29 +02:00
parent ce285ea265
commit 33f3fa6865
91 changed files with 2057 additions and 2254 deletions

View File

@@ -466,7 +466,7 @@ void ImageTriangulation::perform()
const MeshCore::MeshFacetArray& face = kernel.GetFacets();
MeshCore::MeshAlgorithm meshAlg(kernel);
meshAlg.SetPointFlag(MeshCore::MeshPoint::INVALID);
std::vector<unsigned long> validPoints;
std::vector<MeshCore::PointIndex> validPoints;
validPoints.reserve(face.size()*3);
for (MeshCore::MeshFacetArray::_TConstIterator it = face.begin(); it != face.end(); ++it) {
validPoints.push_back(it->_aulPoints[0]);
@@ -481,7 +481,7 @@ void ImageTriangulation::perform()
unsigned long countInvalid = meshAlg.CountPointFlag(MeshCore::MeshPoint::INVALID);
if (countInvalid > 0) {
std::vector<unsigned long> invalidPoints;
std::vector<MeshCore::PointIndex> invalidPoints;
invalidPoints.reserve(countInvalid);
meshAlg.GetPointsFlag(invalidPoints, MeshCore::MeshPoint::INVALID);

View File

@@ -227,8 +227,8 @@ void CmdApproxCylinder::activated(int)
// get normals
{
std::vector<unsigned long> facets(kernel.CountFacets());
std::generate(facets.begin(), facets.end(), Base::iotaGen<unsigned long>(0));
std::vector<MeshCore::FacetIndex> facets(kernel.CountFacets());
std::generate(facets.begin(), facets.end(), Base::iotaGen<MeshCore::FacetIndex>(0));
std::vector<Base::Vector3f> normals = kernel.GetFacetNormals(facets);
Base::Vector3f base = fit.GetGravity();
Base::Vector3f axis = fit.GetInitialAxisFromNormals(normals);
@@ -460,7 +460,7 @@ void CmdSegmentationFromComponents::activated(int)
group->Label.setValue(labelname);
const Mesh::MeshObject& mesh = it->Mesh.getValue();
std::vector<std::vector<unsigned long> > comps = mesh.getComponents();
std::vector<std::vector<MeshCore::FacetIndex> > comps = mesh.getComponents();
for (auto jt : comps) {
std::unique_ptr<Mesh::MeshObject> segment(mesh.meshFromSegment(jt));
Mesh::Feature* feaSegm = static_cast<Mesh::Feature*>(group->addObject("Mesh::Feature", "Segment"));

View File

@@ -111,7 +111,7 @@ void Segmentation::accept()
// For each planar segment compute a plane and use this then for a more accurate 2nd segmentation
if (strcmp((*it)->GetType(), "Plane") == 0) {
for (std::vector<MeshCore::MeshSegment>::const_iterator jt = data.begin(); jt != data.end(); ++jt) {
std::vector<unsigned long> indexes = kernel.GetFacetPoints(*jt);
std::vector<MeshCore::PointIndex> indexes = kernel.GetFacetPoints(*jt);
MeshCore::PlaneFit fit;
fit.AddPoints(kernel.GetPoints(indexes));
if (fit.Fit() < FLOAT_MAX) {
@@ -213,7 +213,7 @@ void Segmentation::accept()
if (createUnused) {
// collect all facets that don't have set the flag TMP0
std::vector<unsigned long> unusedFacets;
std::vector<MeshCore::FacetIndex> unusedFacets;
algo.GetFacetsFlag(unusedFacets, MeshCore::MeshFacet::TMP0);
if (!unusedFacets.empty()) {

View File

@@ -130,7 +130,8 @@ static void findGeometry(int minFaces, double tolerance,
if (mesh.hasSelectedFacets()) {
const MeshCore::MeshKernel& kernel = mesh.getKernel();
std::vector<unsigned long> facets, vertexes;
std::vector<MeshCore::FacetIndex> facets;
std::vector<MeshCore::PointIndex> vertexes;
mesh.getFacetsFromSelection(facets);
vertexes = mesh.getPointsFromFacets(facets);
MeshCore::MeshPointArray coords = kernel.GetPoints(vertexes);
@@ -244,7 +245,7 @@ void SegmentationManual::createSegment()
if (ct > 0) {
selected = true;
std::vector<unsigned long> facets;
std::vector<MeshCore::FacetIndex> facets;
algo.GetFacetsFlag(facets, MeshCore::MeshFacet::SELECTED);
std::unique_ptr<Mesh::MeshObject> segment(mesh.meshFromSegment(facets));