Mesh segmentation

This commit is contained in:
wmayer 2012-05-18 19:07:27 +02:00
parent fc53283239
commit 1b46fc55b7
2 changed files with 17 additions and 5 deletions

View File

@ -35,6 +35,10 @@ void MeshSurfaceSegment::Initialize(unsigned long)
{
}
void MeshSurfaceSegment::AddFacet(const MeshFacet&)
{
}
void MeshSurfaceSegment::AddSegment(const std::vector<unsigned long>& segm)
{
if (segm.size() >= minFacets) {
@ -76,10 +80,15 @@ bool MeshDistancePlanarSegment::TestFacet (const MeshFacet& face) const
return false;
}
fitter->AddPoint(triangle.GetGravityPoint());
return true;
}
void MeshDistancePlanarSegment::AddFacet(const MeshFacet& face)
{
MeshGeomFacet triangle = kernel.GetFacet(face);
fitter->AddPoint(triangle.GetGravityPoint());
}
// --------------------------------------------------------
bool MeshCurvaturePlanarSegment::TestFacet (const MeshFacet &rclFacet) const
@ -153,7 +162,7 @@ bool MeshCurvatureFreeformSegment::TestFacet (const MeshFacet &rclFacet) const
// --------------------------------------------------------
MeshSurfaceVisitor::MeshSurfaceVisitor (const MeshSurfaceSegment& segm, std::vector<unsigned long> &indices)
MeshSurfaceVisitor::MeshSurfaceVisitor (MeshSurfaceSegment& segm, std::vector<unsigned long> &indices)
: indices(indices), segm(segm)
{
}
@ -172,6 +181,7 @@ bool MeshSurfaceVisitor::Visit (const MeshFacet & face, const MeshFacet &,
unsigned long ulFInd, unsigned long)
{
indices.push_back(ulFInd);
segm.AddFacet(face);
return true;
}

View File

@ -42,6 +42,7 @@ public:
virtual ~MeshSurfaceSegment() {}
virtual bool TestFacet (const MeshFacet &rclFacet) const = 0;
virtual void Initialize(unsigned long);
virtual void AddFacet(const MeshFacet& rclFacet);
void AddSegment(const std::vector<unsigned long>&);
const std::vector<MeshSegment>& GetSegments() const { return segments; }
@ -68,8 +69,9 @@ class MeshExport MeshDistancePlanarSegment : public MeshDistanceSurfaceSegment
public:
MeshDistancePlanarSegment(const MeshKernel& mesh, unsigned long minFacets, float tol);
virtual ~MeshDistancePlanarSegment();
bool TestFacet (const MeshFacet &rclFacet) const;
bool TestFacet (const MeshFacet& rclFacet) const;
void Initialize(unsigned long);
void AddFacet(const MeshFacet& rclFacet);
protected:
Base::Vector3f basepoint;
@ -134,7 +136,7 @@ private:
class MeshExport MeshSurfaceVisitor : public MeshFacetVisitor
{
public:
MeshSurfaceVisitor (const MeshSurfaceSegment& segm, std::vector<unsigned long> &indices);
MeshSurfaceVisitor (MeshSurfaceSegment& segm, std::vector<unsigned long> &indices);
virtual ~MeshSurfaceVisitor ();
bool AllowVisit (const MeshFacet& face, const MeshFacet&,
unsigned long, unsigned long, unsigned short neighbourIndex);
@ -143,7 +145,7 @@ public:
protected:
std::vector<unsigned long> &indices;
const MeshSurfaceSegment& segm;
MeshSurfaceSegment& segm;
};
class MeshExport MeshSegmentAlgorithm