| #pragma once |
| |
| #ifndef TSTROKES_DEFORMATIONS_H |
| #define TSTROKES_DEFORMATIONS_H |
| |
| |
| #include "tgeometry.h" |
| #include <memory> |
| |
| #undef DVAPI |
| #undef DVVAR |
| |
| #ifdef TVRENDER_EXPORTS |
| #define DVAPI DV_EXPORT_API |
| #define DVVAR DV_EXPORT_VAR |
| #else |
| #define DVAPI DV_IMPORT_API |
| #define DVVAR DV_IMPORT_VAR |
| #endif |
| |
| class TStroke; |
| |
| |
| |
| |
| |
| |
| class DVAPI TStrokeDeformation { |
| public: |
| TStrokeDeformation() {} |
| virtual ~TStrokeDeformation() {} |
| |
| |
| |
| |
| |
| |
| |
| |
| virtual TThickPoint getDisplacement(const TStroke &stroke, |
| double w) const = 0; |
| |
| |
| |
| |
| |
| |
| |
| |
| virtual TThickPoint getDisplacementForControlPoint(const TStroke &stroke, |
| UINT n) const = 0; |
| virtual TThickPoint getDisplacementForControlPointLen(const TStroke &stroke, |
| double cpLen) const = 0; |
| |
| |
| |
| |
| |
| |
| |
| virtual double getDelta(const TStroke &stroke, double w) const = 0; |
| |
| |
| |
| |
| |
| |
| virtual double getMaxDiff() const = 0; |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI TStrokePointDeformation final : public TStrokeDeformation { |
| protected: |
| struct Imp; |
| std::unique_ptr<Imp> m_imp; |
| |
| public: |
| |
| |
| |
| TStrokePointDeformation(const TPointD ¢er = TPointD(), |
| double radius = 40.0); |
| |
| |
| |
| |
| TStrokePointDeformation(const TPointD &vect, |
| const TPointD ¢er = TPointD(), |
| double radius = 40.0); |
| |
| virtual ~TStrokePointDeformation(); |
| |
| TThickPoint getDisplacement(const TStroke &stroke, double s) const override; |
| TThickPoint getDisplacementForControlPoint(const TStroke &s, |
| UINT n) const override; |
| TThickPoint getDisplacementForControlPointLen(const TStroke &stroke, |
| double cpLen) const override; |
| |
| double getDelta(const TStroke &stroke, double w) const override; |
| double getMaxDiff() const override; |
| }; |
| |
| |
| |
| |
| |
| |
| |
| |
| class DVAPI TStrokeParamDeformation final : public TStrokeDeformation { |
| private: |
| const TStroke *m_pRef; |
| double m_startParameter; |
| double m_lengthOfDeformation; |
| TPointD *m_vect; |
| |
| public: |
| |
| |
| |
| |
| |
| |
| |
| TStrokeParamDeformation(const TStroke *stroke, double parameterOfNearest, |
| double lengthOfDeformation = 100); |
| |
| |
| |
| |
| TStrokeParamDeformation(const TStroke *stroke, const TPointD &vect, |
| double parameterOfNearest, |
| double lengthOfDeformation = 100); |
| |
| virtual ~TStrokeParamDeformation(); |
| |
| TThickPoint getDisplacement(const TStroke &, double) const override; |
| TThickPoint getDisplacementForControlPoint(const TStroke &stroke, |
| UINT n) const override; |
| TThickPoint getDisplacementForControlPointLen(const TStroke &stroke, |
| double cpLen) const override; |
| |
| double getDelta(const TStroke &, double) const override; |
| |
| double getMaxDiff() const override; |
| }; |
| |
| |
| |
| |
| |
| |
| class DVAPI TStrokeThicknessDeformation final : public TStrokeDeformation { |
| private: |
| double m_lengthOfDeformation; |
| double m_startParameter; |
| double m_versus; |
| TPointD *m_vect; |
| const TStroke *m_pRef; |
| |
| public: |
| |
| |
| |
| |
| |
| |
| |
| TStrokeThicknessDeformation(const TStroke *stroke, double parameterOfNearest, |
| double lengthOfDeformation = 100); |
| |
| |
| |
| |
| TStrokeThicknessDeformation(const TStroke *stroke, const TPointD &vect, |
| double parameterOfNearest, |
| double lengthOfDeformation = 100, |
| double versus = 1.0); |
| |
| virtual ~TStrokeThicknessDeformation(); |
| |
| TThickPoint getDisplacement(const TStroke &, double) const override; |
| TThickPoint getDisplacementForControlPoint(const TStroke &stroke, |
| UINT n) const override; |
| TThickPoint getDisplacementForControlPointLen(const TStroke &stroke, |
| double cpLen) const override; |
| |
| double getDelta(const TStroke &, double) const override; |
| |
| double getMaxDiff() const override; |
| }; |
| |
| |
| |
| |
| class DVAPI TStrokeBenderDeformation final : public TStrokeDeformation { |
| private: |
| const TStroke *m_pRef; |
| double m_startLength; |
| double m_lengthOfDeformation; |
| TPointD *m_vect; |
| int m_versus; |
| |
| double m_angle; |
| |
| public: |
| enum VERSUS { INNER = 0, OUTER }; |
| |
| |
| |
| |
| |
| |
| |
| TStrokeBenderDeformation(const TStroke *stroke, double parameterOfNearest, |
| double lengthOfDeformation = 50); |
| |
| |
| |
| |
| TStrokeBenderDeformation(const TStroke *stroke, const TPointD ¢erOfRot, |
| double angle, double parameterOfNearest, |
| int innerOrOuter = INNER, |
| double lengthOfDeformation = 50); |
| |
| virtual ~TStrokeBenderDeformation(); |
| |
| TThickPoint getDisplacement(const TStroke &, double s) const override; |
| TThickPoint getDisplacementForControlPoint(const TStroke &, |
| UINT n) const override; |
| TThickPoint getDisplacementForControlPointLen(const TStroke &stroke, |
| double cpLen) const override; |
| |
| double getDelta(const TStroke &, double) const override; |
| double getMaxDiff() const override; |
| }; |
| |
| |
| |
| |
| |
| |
| class DVAPI TStrokeTwirlDeformation final : public TStrokeDeformation { |
| private: |
| TPointD m_center; |
| double m_innerRadius2; |
| TPointD m_vectorOfMovement; |
| double m_outerRadius; |
| |
| public: |
| |
| |
| |
| |
| TStrokeTwirlDeformation(const TPointD ¢er, double radius); |
| |
| TStrokeTwirlDeformation(const TPointD ¢er, double radius, |
| const TPointD &v); |
| |
| virtual ~TStrokeTwirlDeformation(); |
| |
| TThickPoint getDisplacement(const TStroke &, double s) const override; |
| double getDelta(const TStroke &, double) const override; |
| double getMaxDiff() const override; |
| }; |
| |
| |
| |
| |
| |
| |
| class DVAPI TPointDeformation { |
| const TStroke *m_strokeRef; |
| TPointD m_center; |
| double m_radius; |
| |
| |
| double getCPDensity(double s) const; |
| |
| public: |
| TPointDeformation(const TStroke *, const TPointD &, double center); |
| |
| TPointDeformation(); |
| |
| virtual ~TPointDeformation(); |
| |
| TThickPoint getDisplacement(double s) const; |
| |
| |
| |
| |
| |
| |
| |
| |
| double getCPCountInRange(double s0, double s1) const; |
| |
| |
| double getMinCPDensity() const; |
| }; |
| |
| |
| #endif |