diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/freestyle/intern/geometry/FitCurve.h | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/freestyle/intern/geometry/FitCurve.h')
-rw-r--r-- | source/blender/freestyle/intern/geometry/FitCurve.h | 141 |
1 files changed, 69 insertions, 72 deletions
diff --git a/source/blender/freestyle/intern/geometry/FitCurve.h b/source/blender/freestyle/intern/geometry/FitCurve.h index f32549ed526..92afd685d8f 100644 --- a/source/blender/freestyle/intern/geometry/FitCurve.h +++ b/source/blender/freestyle/intern/geometry/FitCurve.h @@ -34,83 +34,80 @@ namespace Freestyle { using namespace Geometry; /* 2d point */ -typedef struct Point2Struct -{ - double coordinates[2]; - - Point2Struct() - { - coordinates[0] = 0; - coordinates[1] = 0; - } - - inline double operator[](const int i) const - { - return coordinates[i]; - } - - inline double& operator[](const int i) - { - return coordinates[i]; - } - - inline double x() const - { - return coordinates[0]; - } - - inline double y() const - { - return coordinates[1]; - } +typedef struct Point2Struct { + double coordinates[2]; + + Point2Struct() + { + coordinates[0] = 0; + coordinates[1] = 0; + } + + inline double operator[](const int i) const + { + return coordinates[i]; + } + + inline double &operator[](const int i) + { + return coordinates[i]; + } + + inline double x() const + { + return coordinates[0]; + } + + inline double y() const + { + return coordinates[1]; + } } Point2; typedef Point2 Vector2; - -class FitCurveWrapper -{ -private: - std::vector<Vector2> _vertices; - -public: - FitCurveWrapper(); - ~FitCurveWrapper(); - - /*! Fits a set of 2D data points to a set of Bezier Curve segments - * data - * Input data points - * oCurve - * Control points of the sets of bezier curve segments. - * Each segment is made of 4 points (polynomial degree of curve = 3) - * error - * max error tolerance between resulting curve and input data - */ - void FitCurve(std::vector<Vec2d>& data, std::vector<Vec2d>& oCurve, double error); - -protected: - /* Vec2d *d; Array of digitized points - * int nPts; Number of digitized points - * double error; User-defined error squared - */ - void FitCurve(Vector2 *d, int nPts, double error); - - /*! Draws a Bezier curve segment - * n - * degree of curve (=3) - * curve - * bezier segments control points - */ - void DrawBezierCurve(int n, Vector2 *curve); - - /* Vec2d *d; Array of digitized points - * int first, last; Indices of first and last pts in region - * Vec2d tHat1, tHat2; Unit tangent vectors at endpoints - * double error; User-defined error squared - */ - void FitCubic(Vector2 *d, int first, int last, Vector2 tHat1, Vector2 tHat2, double error); +class FitCurveWrapper { + private: + std::vector<Vector2> _vertices; + + public: + FitCurveWrapper(); + ~FitCurveWrapper(); + + /*! Fits a set of 2D data points to a set of Bezier Curve segments + * data + * Input data points + * oCurve + * Control points of the sets of bezier curve segments. + * Each segment is made of 4 points (polynomial degree of curve = 3) + * error + * max error tolerance between resulting curve and input data + */ + void FitCurve(std::vector<Vec2d> &data, std::vector<Vec2d> &oCurve, double error); + + protected: + /* Vec2d *d; Array of digitized points + * int nPts; Number of digitized points + * double error; User-defined error squared + */ + void FitCurve(Vector2 *d, int nPts, double error); + + /*! Draws a Bezier curve segment + * n + * degree of curve (=3) + * curve + * bezier segments control points + */ + void DrawBezierCurve(int n, Vector2 *curve); + + /* Vec2d *d; Array of digitized points + * int first, last; Indices of first and last pts in region + * Vec2d tHat1, tHat2; Unit tangent vectors at endpoints + * double error; User-defined error squared + */ + void FitCubic(Vector2 *d, int first, int last, Vector2 tHat1, Vector2 tHat2, double error); }; } /* namespace Freestyle */ -#endif // __FITCURVE_H__ +#endif // __FITCURVE_H__ |