swh:1:snp:818279ffd0c3c25a68d33cc2b97d007e1bdc7ed6
Raw File
Tip revision: 8abaf41b7c113afafcca20c0b869826efb0c6e6b authored by ennetws on 15 January 2014, 06:15:06 UTC
Changes to filtering.
Tip revision: 8abaf41
segment.h
#pragma once
#include "SurfaceMeshPlugins.h"
#include "RichParameterSet.h"

#include "SurfaceMeshModel.h"
#include "SurfaceMeshHelper.h"

namespace SurfaceMesh{

enum FaceClass {CURVE, SHEET};
typedef QSet<Face> Region;
typedef QVector<Region> RegionVector;

class segment : public SurfaceMeshFilterPlugin{
    Q_OBJECT
    Q_INTERFACES(FilterPlugin)

public:
    QString name() { return "Segment"; }
    QString description() { return "Segment into curves and sheets."; }

    void initParameters(RichParameterSet* pars);
    void applyFilter(RichParameterSet* pars);
	
	void initMesh();
	void GrowRegions();

	Vector3VertexProperty points;
	ScalarFaceProperty farea;
	ScalarEdgeProperty elen;
	ScalarVertexProperty vclass;
    Surface_mesh::Face_property<QString> faceTarget;

	// Classification & region growing
	Surface_mesh::Face_property<int> fclass;
	BoolFaceProperty fvisited;
	void resetClassfication();
	void resetVisitFlag();
	void resetVertexClass();

	RegionVector curve_regions;
	RegionVector sheet_regions;

	double minAngle(Face f);
	Vector3 center(Face f);
	Region growRegion(Face f);
	void invertRegion( Region & r );

	void performCurveSheetSegmentation(double theta, double minRadius, int k, bool isExtract = true, bool isVisualize = false);

	void classifyVertsFromFaces();
	void collectRing(Vertex v, QSet<Vertex> & set, int level = 0);
	void setMeshFromRegion(Region & r, SurfaceMesh::Model *);

	double median(QVector<double> vec);

    void splitCurveRegion(Region &r);

    void doGraph();
};


}
back to top