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

@@ -44,10 +44,10 @@ using namespace MeshCore;
PROPERTY_SOURCE(Mesh::SegmentByMesh, Mesh::Feature)
SegmentByMesh::SegmentByMesh(void)
SegmentByMesh::SegmentByMesh()
{
ADD_PROPERTY(Source ,(0));
ADD_PROPERTY(Tool ,(0));
ADD_PROPERTY(Source ,(nullptr));
ADD_PROPERTY(Tool ,(nullptr));
ADD_PROPERTY(Base ,(0.0,0.0,0.0));
ADD_PROPERTY(Normal ,(0.0,0.0,1.0));
}
@@ -63,9 +63,9 @@ short SegmentByMesh::mustExecute() const
return 0;
}
App::DocumentObjectExecReturn *SegmentByMesh::execute(void)
App::DocumentObjectExecReturn *SegmentByMesh::execute()
{
Mesh::PropertyMeshKernel *kernel=0;
Mesh::PropertyMeshKernel *kernel=nullptr;
App::DocumentObject* mesh = Source.getValue();
if (mesh) {
App::Property* prop = mesh->getPropertyByName("Mesh");
@@ -77,7 +77,7 @@ App::DocumentObjectExecReturn *SegmentByMesh::execute(void)
else if (mesh->isError())
return new App::DocumentObjectExecReturn("No valid mesh.\n");
Mesh::PropertyMeshKernel *toolmesh=0;
Mesh::PropertyMeshKernel *toolmesh=nullptr;
App::DocumentObject* tool = Tool.getValue();
if (tool) {
App::Property* prop = tool->getPropertyByName("Mesh");
@@ -106,7 +106,7 @@ App::DocumentObjectExecReturn *SegmentByMesh::execute(void)
return new App::DocumentObjectExecReturn("Toolmesh is not solid.\n");
}
std::vector<unsigned long> faces;
std::vector<MeshCore::FacetIndex> faces;
std::vector<MeshGeomFacet> aFaces;
MeshAlgorithm cAlg(rMeshKernel);
@@ -121,11 +121,11 @@ App::DocumentObjectExecReturn *SegmentByMesh::execute(void)
// so we need the nearest facet to the front clipping plane
//
float fDist = FLOAT_MAX;
unsigned long uIdx=ULONG_MAX;
MeshCore::FacetIndex uIdx = MeshCore::FACET_INDEX_MAX;
MeshFacetIterator cFIt(rMeshKernel);
// get the nearest facet to the user (front clipping plane)
for ( std::vector<unsigned long>::iterator it = faces.begin(); it != faces.end(); ++it ) {
for ( std::vector<MeshCore::FacetIndex>::iterator it = faces.begin(); it != faces.end(); ++it ) {
cFIt.Set(*it);
float dist = (float)fabs(cFIt->GetGravityPoint().DistanceToPlane( cBase, cNormal ));
if ( dist < fDist ) {
@@ -135,7 +135,7 @@ App::DocumentObjectExecReturn *SegmentByMesh::execute(void)
}
// succeeded
if ( uIdx != ULONG_MAX ) {
if ( uIdx != MeshCore::FACET_INDEX_MAX ) {
// set VISIT-Flag to all outer facets
cAlg.SetFacetFlag( MeshFacet::VISIT );
cAlg.ResetFacetsFlag(faces, MeshFacet::VISIT);
@@ -149,7 +149,7 @@ App::DocumentObjectExecReturn *SegmentByMesh::execute(void)
}
}
for ( std::vector<unsigned long>::iterator it = faces.begin(); it != faces.end(); ++it )
for ( std::vector<MeshCore::FacetIndex>::iterator it = faces.begin(); it != faces.end(); ++it )
aFaces.push_back( rMeshKernel.GetFacet(*it) );
std::unique_ptr<MeshObject> pcKernel(new MeshObject);