Salome HOME
Porting to ParaView 5.8
[modules/geom.git] / src / CurveCreator / CurveCreator_Utils.hxx
index 78be98b009f98315c60a7ffca808b540305c6142..20ded32d5c7c064b80d4a4a8bd0942e3dd072267 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2013-2019  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -29,7 +29,9 @@
 #include <gp_Pnt.hxx>
 #include <Geom_Curve.hxx>
 #include <TopoDS_Shape.hxx>
+#include <TopoDS_Wire.hxx>
 #include <TColgp_HArray1OfPnt.hxx>
+#include <Geom_BSplineCurve.hxx>
 
 #include <list>
 #include <vector> // TODO: remove
@@ -132,6 +134,28 @@ public:
                                                  gp_Pnt& thePoint, gp_Pnt& thePoint1,
                                                  gp_Pnt& thePoint2 );
 
+  /**
+   * The algorithm builds the cubic B-spline passing through the points that the
+   * tangent vector in each given point P is calculated by the following way:
+   * if point P is preceded by a point A and is followed by a point B then
+   * the tangent vector is equal to (P - A) / |P - A| + (B - P) / |B - P|;
+   * if point P is preceded by a point A but is not followed by any point then
+   * the tangent vector is equal to P - A;
+   * if point P is followed by a point B but is not preceded by any point then
+   * the tangent vector is equal to B - P.
+   */
+  CURVECREATOR_EXPORT static bool constructBSpline( const Handle(TColgp_HArray1OfPnt)& thePoints,
+                                                    const Standard_Boolean theIsClosed,
+                                                    Handle(Geom_BSplineCurve)& theBSpline );
+
+  /**
+   * Constructs the wire corresponding to the section.
+   */
+  CURVECREATOR_EXPORT static TopoDS_Wire ConstructWire(
+    Handle(TColgp_HArray1OfPnt) thePoints,
+    const bool theIsPolyline,
+    const bool theIsClosed);
+
 protected:
   /*
    * Returns whether the clicked point belong to the curve or has a very near projection
@@ -181,7 +205,7 @@ protected:
    * \param IsBSpline BSpline flag. Output parameter.
    * \return the array of points. Null handle in case of failure.
    */
-  static Handle_TColgp_HArray1OfPnt getPoints
+  static Handle(TColgp_HArray1OfPnt) getPoints
                            (const TopoDS_Shape &theShape,
                                   bool         &IsClosed,
                                   bool         &IsBSpline);
@@ -202,7 +226,7 @@ protected:
    * \param thePlnStatus the current status on input. It can be modified on
    *        output.
    */
-  static void FindPlane(const Handle_TColgp_HArray1OfPnt &thePoints,
+  static void FindPlane(const Handle(TColgp_HArray1OfPnt) &thePoints,
                               gp_Pln                     &thePlane,
                               Standard_Integer           &thePlnStatus);