Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:33

0001 // Created on: 1994-03-23
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 _Geom2dAPI_PointsToBSpline_HeaderFile
0018 #define _Geom2dAPI_PointsToBSpline_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <TColgp_Array1OfPnt2d.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <GeomAbs_Shape.hxx>
0027 #include <TColStd_Array1OfReal.hxx>
0028 #include <Approx_ParametrizationType.hxx>
0029 class Geom2d_BSplineCurve;
0030 
0031 
0032 //! This  class  is  used  to  approximate a  BsplineCurve
0033 //! passing  through an  array  of points,  with  a  given
0034 //! Continuity.
0035 //! Describes functions for building a 2D BSpline
0036 //! curve which approximates a set of points.
0037 //! A PointsToBSpline object provides a framework for:
0038 //! -   defining the data of the BSpline curve to be built,
0039 //! -   implementing the approximation algorithm, and
0040 //! -   consulting the results
0041 class Geom2dAPI_PointsToBSpline 
0042 {
0043 public:
0044 
0045   DEFINE_STANDARD_ALLOC
0046 
0047   
0048   //! Constructs an empty approximation algorithm.
0049   //! Use an Init function to define and build the BSpline curve.
0050   Standard_EXPORT Geom2dAPI_PointsToBSpline();
0051   
0052   //! Approximate  a BSpline  Curve passing  through  an
0053   //! array of  Point.  The resulting BSpline will  have
0054   //! the following properties:
0055   //! 1- his degree will be in the range [Degmin,Degmax]
0056   //! 2- his  continuity will be  at  least <Continuity>
0057   //! 3- the distance from the point <Points> to the
0058   //! BSpline will be lower to Tol2D
0059   Standard_EXPORT Geom2dAPI_PointsToBSpline(const TColgp_Array1OfPnt2d& Points, const Standard_Integer DegMin = 3, const Standard_Integer DegMax = 8, const GeomAbs_Shape Continuity = GeomAbs_C2, const Standard_Real Tol2D = 1.0e-6);
0060   
0061   //! Approximate  a BSpline  Curve passing  through  an
0062   //! array of  Point.  Of coordinates :
0063   //!
0064   //! X = X0 + DX * (i-YValues.Lower())
0065   //! Y = YValues(i)
0066   //!
0067   //! With i in the range YValues.Lower(), YValues.Upper()
0068   //!
0069   //! The BSpline will be parametrized  from t = X0 to
0070   //! X0 + DX * (YValues.Upper() - YValues.Lower())
0071   //!
0072   //! And will satisfy X(t) = t
0073   //!
0074   //! The resulting BSpline will  have
0075   //! the following properties:
0076   //! 1- his degree will be in the range [Degmin,Degmax]
0077   //! 2- his  continuity will be  at  least <Continuity>
0078   //! 3- the distance from the point <Points> to the
0079   //! BSpline will be lower to Tol2D
0080   Standard_EXPORT Geom2dAPI_PointsToBSpline(const TColStd_Array1OfReal& YValues, const Standard_Real X0, const Standard_Real DX, const Standard_Integer DegMin = 3, const Standard_Integer DegMax = 8, const GeomAbs_Shape Continuity = GeomAbs_C2, const Standard_Real Tol2D = 1.0e-6);
0081   
0082   //! Approximate  a BSpline  Curve passing  through  an
0083   //! array of  Point.  The resulting BSpline will  have
0084   //! the following properties:
0085   //! 1- his degree will be in the range [Degmin,Degmax]
0086   //! 2- his  continuity will be  at  least <Continuity>
0087   //! 3- the distance from the point <Points> to the
0088   //! BSpline will be lower to Tol2D
0089   Standard_EXPORT Geom2dAPI_PointsToBSpline(const TColgp_Array1OfPnt2d& Points, const Approx_ParametrizationType ParType, const Standard_Integer DegMin = 3, const Standard_Integer DegMax = 8, const GeomAbs_Shape Continuity = GeomAbs_C2, const Standard_Real Tol2D = 1.0e-3);
0090   
0091   //! Approximate  a  BSpline  Curve  passing through an
0092   //! array of Point,  which parameters are given by the
0093   //! array <Parameters>.
0094   //! The resulting  BSpline   will have the   following
0095   //! properties:
0096   //! 1- his degree will be in the range [Degmin,Degmax]
0097   //! 2- his  continuity will be  at  least <Continuity>
0098   //! 3- the distance from the point <Points> to the
0099   //! BSpline will be lower to Tol2D
0100   Standard_EXPORT Geom2dAPI_PointsToBSpline(const TColgp_Array1OfPnt2d& Points, const TColStd_Array1OfReal& Parameters, const Standard_Integer DegMin = 3, const Standard_Integer DegMax = 8, const GeomAbs_Shape Continuity = GeomAbs_C2, const Standard_Real Tol2D = 1.0e-3);
0101   
0102   //! Approximate a BSpline Curve  passing through an
0103   //! array of Point using variational smoothing algorithm,
0104   //! which tries to minimize additional criterium:
0105   //! Weight1*CurveLength + Weight2*Curvature + Weight3*Torsion
0106   Standard_EXPORT Geom2dAPI_PointsToBSpline(const TColgp_Array1OfPnt2d& Points, const Standard_Real Weight1, const Standard_Real Weight2, const Standard_Real Weight3, const Standard_Integer DegMax = 8, const GeomAbs_Shape Continuity = GeomAbs_C2, const Standard_Real Tol3D = 1.0e-3);
0107   
0108   //! Approximate  a BSpline  Curve passing  through  an
0109   //! array of  Point.  The resulting BSpline will  have
0110   //! the following properties:
0111   //! 1- his degree will be in the range [Degmin,Degmax]
0112   //! 2- his  continuity will be  at  least <Continuity>
0113   //! 3- the distance from the point <Points> to the
0114   //! BSpline will be lower to Tol2D
0115   Standard_EXPORT void Init (const TColgp_Array1OfPnt2d& Points, const Standard_Integer DegMin = 3, const Standard_Integer DegMax = 8, const GeomAbs_Shape Continuity = GeomAbs_C2, const Standard_Real Tol2D = 1.0e-6);
0116   
0117   //! Approximate  a BSpline  Curve passing  through  an
0118   //! array of  Point.  Of coordinates :
0119   //!
0120   //! X = X0 + DX * (i-YValues.Lower())
0121   //! Y = YValues(i)
0122   //!
0123   //! With i in the range YValues.Lower(), YValues.Upper()
0124   //!
0125   //! The BSpline will be parametrized  from t = X0 to
0126   //! X0 + DX * (YValues.Upper() - YValues.Lower())
0127   //!
0128   //! And will satisfy X(t) = t
0129   //!
0130   //! The resulting BSpline will  have
0131   //! the following properties:
0132   //! 1- his degree will be in the range [Degmin,Degmax]
0133   //! 2- his  continuity will be  at  least <Continuity>
0134   //! 3- the distance from the point <Points> to the
0135   //! BSpline will be lower to Tol2D
0136   Standard_EXPORT void Init (const TColStd_Array1OfReal& YValues, const Standard_Real X0, const Standard_Real DX, const Standard_Integer DegMin = 3, const Standard_Integer DegMax = 8, const GeomAbs_Shape Continuity = GeomAbs_C2, const Standard_Real Tol2D = 1.0e-6);
0137   
0138   //! Approximate  a BSpline  Curve passing  through  an
0139   //! array of  Point.  The resulting BSpline will  have
0140   //! the following properties:
0141   //! 1- his degree will be in the range [Degmin,Degmax]
0142   //! 2- his  continuity will be  at  least <Continuity>
0143   //! 3- the distance from the point <Points> to the
0144   //! BSpline will be lower to Tol2D
0145   Standard_EXPORT void Init (const TColgp_Array1OfPnt2d& Points, const Approx_ParametrizationType ParType, const Standard_Integer DegMin = 3, const Standard_Integer DegMax = 8, const GeomAbs_Shape Continuity = GeomAbs_C2, const Standard_Real Tol2D = 1.0e-3);
0146   
0147   //! Approximate  a  BSpline  Curve  passing through an
0148   //! array of Point,  which parameters are given by the
0149   //! array <Parameters>.
0150   //! The resulting  BSpline   will have the   following
0151   //! properties:
0152   //! 1- his degree will be in the range [Degmin,Degmax]
0153   //! 2- his  continuity will be  at  least <Continuity>
0154   //! 3- the distance from the point <Points> to the
0155   //! BSpline will be lower to Tol2D
0156   Standard_EXPORT void Init (const TColgp_Array1OfPnt2d& Points, const TColStd_Array1OfReal& Parameters, const Standard_Integer DegMin = 3, const Standard_Integer DegMax = 8, const GeomAbs_Shape Continuity = GeomAbs_C2, const Standard_Real Tol2D = 1.0e-3);
0157   
0158   //! Approximate a BSpline Curve  passing through an
0159   //! array of Point using variational smoothing algorithm,
0160   //! which tries to minimize additional criterium:
0161   //! Weight1*CurveLength + Weight2*Curvature + Weight3*Torsion
0162   Standard_EXPORT void Init (const TColgp_Array1OfPnt2d& Points, const Standard_Real Weight1, const Standard_Real Weight2, const Standard_Real Weight3, const Standard_Integer DegMax = 8, const GeomAbs_Shape Continuity = GeomAbs_C2, const Standard_Real Tol2D = 1.0e-3);
0163   
0164   //! Returns the approximate BSpline Curve
0165   Standard_EXPORT const Handle(Geom2d_BSplineCurve)& Curve() const;
0166 Standard_EXPORT operator Handle(Geom2d_BSplineCurve)() const;
0167   
0168   Standard_EXPORT Standard_Boolean IsDone() const;
0169 
0170 
0171 
0172 
0173 protected:
0174 
0175 
0176 
0177 
0178 
0179 private:
0180 
0181 
0182 
0183   Standard_Boolean myIsDone;
0184   Handle(Geom2d_BSplineCurve) myCurve;
0185 
0186 
0187 };
0188 
0189 
0190 
0191 
0192 
0193 
0194 
0195 #endif // _Geom2dAPI_PointsToBSpline_HeaderFile