swh:1:snp:818279ffd0c3c25a68d33cc2b97d007e1bdc7ed6
Raw File
Tip revision: 39b13612ebd645a65eda854771b517371f2f858a authored by ennetws on 13 March 2015, 18:17:18 UTC
Create README.md
Tip revision: 39b1361
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