Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-14 09:14:27

0001 // Created on: 1994-03-21
0002 // Created by: Bruno DUMORTIER
0003 // Copyright (c) 1994-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _GeomAPI_PointsToBSpline_HeaderFile
0018 #define _GeomAPI_PointsToBSpline_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <gp_Pnt.hxx>
0025 #include <NCollection_Array1.hxx>
0026 #include <Standard_Integer.hxx>
0027 #include <GeomAbs_Shape.hxx>
0028 #include <Approx_ParametrizationType.hxx>
0029 class Geom_BSplineCurve;
0030 
0031 //! This class is used to approximate a BsplineCurve
0032 //! passing through an array of points, with a given Continuity.
0033 //! Describes functions for building a 3D BSpline
0034 //! curve which approximates a set of points.
0035 //! A PointsToBSpline object provides a framework for:
0036 //! -   defining the data of the BSpline curve to be built,
0037 //! -   implementing the approximation algorithm, and consulting the results.
0038 class GeomAPI_PointsToBSpline
0039 {
0040 public:
0041   DEFINE_STANDARD_ALLOC
0042 
0043   //! Constructs an empty approximation algorithm.
0044   //! Use an Init function to define and build the BSpline curve.
0045   Standard_EXPORT GeomAPI_PointsToBSpline();
0046 
0047   //! Approximate a BSpline Curve passing through an
0048   //! array of Point. The resulting BSpline will have
0049   //! the following properties:
0050   //! 1- his degree will be in the range [Degmin,Degmax]
0051   //! 2- his continuity will be at least <Continuity>
0052   //! 3- the distance from the point <Points> to the
0053   //! BSpline will be lower to Tol3D
0054   Standard_EXPORT GeomAPI_PointsToBSpline(const NCollection_Array1<gp_Pnt>& Points,
0055                                           const int                         DegMin     = 3,
0056                                           const int                         DegMax     = 8,
0057                                           const GeomAbs_Shape               Continuity = GeomAbs_C2,
0058                                           const double                      Tol3D      = 1.0e-3);
0059 
0060   //! Approximate a BSpline Curve passing through an
0061   //! array of Point. The resulting BSpline will have
0062   //! the following properties:
0063   //! 1- his degree will be in the range [Degmin,Degmax]
0064   //! 2- his continuity will be at least <Continuity>
0065   //! 3- the distance from the point <Points> to the
0066   //! BSpline will be lower to Tol3D
0067   Standard_EXPORT GeomAPI_PointsToBSpline(const NCollection_Array1<gp_Pnt>& Points,
0068                                           const Approx_ParametrizationType  ParType,
0069                                           const int                         DegMin     = 3,
0070                                           const int                         DegMax     = 8,
0071                                           const GeomAbs_Shape               Continuity = GeomAbs_C2,
0072                                           const double                      Tol3D      = 1.0e-3);
0073 
0074   //! Approximate a BSpline Curve passing through an
0075   //! array of Point, which parameters are given by the
0076   //! array <Parameters>.
0077   //! The resulting BSpline will have the following
0078   //! properties:
0079   //! 1- his degree will be in the range [Degmin,Degmax]
0080   //! 2- his continuity will be at least <Continuity>
0081   //! 3- the distance from the point <Points> to the
0082   //! BSpline will be lower to Tol3D
0083   Standard_EXPORT GeomAPI_PointsToBSpline(const NCollection_Array1<gp_Pnt>& Points,
0084                                           const NCollection_Array1<double>& Parameters,
0085                                           const int                         DegMin     = 3,
0086                                           const int                         DegMax     = 8,
0087                                           const GeomAbs_Shape               Continuity = GeomAbs_C2,
0088                                           const double                      Tol3D      = 1.0e-3);
0089 
0090   //! Approximate a BSpline Curve passing through an
0091   //! array of Point using variational smoothing algorithm,
0092   //! which tries to minimize additional criterium:
0093   //! Weight1*CurveLength + Weight2*Curvature + Weight3*Torsion
0094   Standard_EXPORT GeomAPI_PointsToBSpline(const NCollection_Array1<gp_Pnt>& Points,
0095                                           const double                      Weight1,
0096                                           const double                      Weight2,
0097                                           const double                      Weight3,
0098                                           const int                         DegMax     = 8,
0099                                           const GeomAbs_Shape               Continuity = GeomAbs_C2,
0100                                           const double                      Tol3D      = 1.0e-3);
0101 
0102   //! Approximate a BSpline Curve passing through an
0103   //! array of Point. The resulting BSpline will have
0104   //! the following properties:
0105   //! 1- his degree will be in the range [Degmin,Degmax]
0106   //! 2- his continuity will be at least <Continuity>
0107   //! 3- the distance from the point <Points> to the
0108   //! BSpline will be lower to Tol3D
0109   Standard_EXPORT void Init(const NCollection_Array1<gp_Pnt>& Points,
0110                             const int                         DegMin     = 3,
0111                             const int                         DegMax     = 8,
0112                             const GeomAbs_Shape               Continuity = GeomAbs_C2,
0113                             const double                      Tol3D      = 1.0e-3);
0114 
0115   //! Approximate a BSpline Curve passing through an
0116   //! array of Point. The resulting BSpline will have
0117   //! the following properties:
0118   //! 1- his degree will be in the range [Degmin,Degmax]
0119   //! 2- his continuity will be at least <Continuity>
0120   //! 3- the distance from the point <Points> to the
0121   //! BSpline will be lower to Tol3D
0122   Standard_EXPORT void Init(const NCollection_Array1<gp_Pnt>& Points,
0123                             const Approx_ParametrizationType  ParType,
0124                             const int                         DegMin     = 3,
0125                             const int                         DegMax     = 8,
0126                             const GeomAbs_Shape               Continuity = GeomAbs_C2,
0127                             const double                      Tol3D      = 1.0e-3);
0128 
0129   //! Approximate a BSpline Curve passing through an
0130   //! array of Point, which parameters are given by the
0131   //! array <Parameters>.
0132   //! The resulting BSpline will have the following
0133   //! properties:
0134   //! 1- his degree will be in the range [Degmin,Degmax]
0135   //! 2- his continuity will be at least <Continuity>
0136   //! 3- the distance from the point <Points> to the
0137   //! BSpline will be lower to Tol3D
0138   Standard_EXPORT void Init(const NCollection_Array1<gp_Pnt>& Points,
0139                             const NCollection_Array1<double>& Parameters,
0140                             const int                         DegMin     = 3,
0141                             const int                         DegMax     = 8,
0142                             const GeomAbs_Shape               Continuity = GeomAbs_C2,
0143                             const double                      Tol3D      = 1.0e-3);
0144 
0145   //! Approximate a BSpline Curve passing through an
0146   //! array of Point using variational smoothing algorithm,
0147   //! which tries to minimize additional criterium:
0148   //! Weight1*CurveLength + Weight2*Curvature + Weight3*Torsion
0149   Standard_EXPORT void Init(const NCollection_Array1<gp_Pnt>& Points,
0150                             const double                      Weight1,
0151                             const double                      Weight2,
0152                             const double                      Weight3,
0153                             const int                         DegMax     = 8,
0154                             const GeomAbs_Shape               Continuity = GeomAbs_C2,
0155                             const double                      Tol3D      = 1.0e-3);
0156 
0157   //! Returns the computed BSpline curve.
0158   //! Raises StdFail_NotDone if the curve is not built.
0159   Standard_EXPORT const occ::handle<Geom_BSplineCurve>& Curve() const;
0160   Standard_EXPORT operator occ::handle<Geom_BSplineCurve>() const;
0161 
0162   Standard_EXPORT bool IsDone() const;
0163 
0164 private:
0165   bool                           myIsDone;
0166   occ::handle<Geom_BSplineCurve> myCurve;
0167 };
0168 
0169 #endif // _GeomAPI_PointsToBSpline_HeaderFile