#ifndef DUST3D_CONTOUR_TO_PART_CONVERTER_H #define DUST3D_CONTOUR_TO_PART_CONVERTER_H #include #include #include #include #include #include "snapshot.h" class ContourToPartConverter : public QObject { Q_OBJECT public: ContourToPartConverter(const QPolygonF &mainProfile, const QPolygonF &sideProfile, const QSizeF &canvasSize); const Snapshot &getSnapshot(); signals: void finished(); public slots: void process(); private: QPolygonF m_mainProfile; QPolygonF m_sideProfile; QSizeF m_canvasSize; Snapshot m_snapshot; static const float m_targetImageHeight; static const float m_minEdgeLength; static const float m_radiusEpsilon; std::vector> m_nodes; void convert(); void extractSkeleton(const QPolygonF &polygon, std::vector> *skeleton); int calculateNodeRadius(const QVector3D &node, const QVector3D &direction, const std::set> &black); void nodesToSnapshot(); void smoothRadius(std::vector> *skeleton); void alignSkeleton(const std::vector> &referenceSkeleton, std::vector> &adjustSkeleton); void optimizeNodes(); }; #endif