]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_GeoExtensions.h
Salome HOME
Issue #17347: B-Splines in Sketcher
[modules/shaper.git] / src / SketchSolver / PlaneGCSSolver / PlaneGCSSolver_GeoExtensions.h
1 // Copyright (C) 2019-2020  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef PlaneGCSSolver_GeomExtensions_H_
21 #define PlaneGCSSolver_GeomExtensions_H_
22
23 #include <PlaneGCSSolver_Defs.h>
24
25 #include <list>
26 #include <memory>
27
28 class GeomAPI_BSpline2d;
29 class GeomAPI_Pnt2d;
30
31 namespace GCS {
32   /// \brife SHAPER's implementation of B-spline curves in PlaneGCS solver
33   class BSplineImpl : public BSpline
34   {
35   public:
36     virtual DeriVector2 Value(double u, double du, double* derivparam = 0);
37
38     virtual BSplineImpl* Copy();
39
40   private:
41     /// Verify the cached curve satisfies to the parameters
42     bool isCacheValid() const;
43     /// Poles or weights are changed, cache curve has to be rebuilt
44     void rebuildCache();
45
46   private:
47     std::shared_ptr<GeomAPI_BSpline2d> myCurve; /// cached B-spline curve
48     std::list<std::shared_ptr<GeomAPI_Pnt2d> > myCachedPoles; /// cached B-spline poles
49     std::list<double> myCachedWeights; /// cached B-spline weights
50   };
51 }
52
53 #endif