#ifndef DUST3D_MODIFIER_H #define DUST3D_MODIFIER_H #include #include class StrokeModifier { public: struct Node { bool isOriginal = false; QVector3D position; float radius = 0.0; std::vector cutTemplate; float cutRotation = 0.0; int nearOriginNodeIndex = -1; int farOriginNodeIndex = -1; int originNodeIndex = 0; float averageCutTemplateLength; }; struct Edge { size_t firstNodeIndex; size_t secondNodeIndex; }; size_t addNode(const QVector3D &position, float radius, const std::vector &cutTemplate, float cutRotation); size_t addEdge(size_t firstNodeIndex, size_t secondNodeIndex); void subdivide(); void roundEnd(); void enableIntermediateAddition(); const std::vector &nodes(); const std::vector &edges(); void finalize(); private: std::vector m_nodes; std::vector m_edges; bool m_intermediateAdditionEnabled = false; void createIntermediateNode(const Node &firstNode, const Node &secondNode, float factor, Node *resultNode); float averageCutTemplateEdgeLength(const std::vector &cutTemplate); void createIntermediateCutTemplateEdges(std::vector &cutTemplate, float averageCutTemplateLength); }; #endif