Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-25 09:19:12

0001 // Created on: 1994-03-03
0002 // Created by: Joelle CHAUVET
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 _BRepFill_ComputeCLine_HeaderFile
0018 #define _BRepFill_ComputeCLine_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <AppParCurves_MultiCurve.hxx>
0024 #include <NCollection_Sequence.hxx>
0025 #include <Standard_Integer.hxx>
0026 #include <AppParCurves_Constraint.hxx>
0027 #include <BRepFill_MultiLine.hxx>
0028 class AppParCurves_MultiCurve;
0029 
0030 class BRepFill_ComputeCLine
0031 {
0032 public:
0033   DEFINE_STANDARD_ALLOC
0034 
0035   //! The MultiLine <Line> will be approximated until tolerances
0036   //! will be reached.
0037   //! The approximation will be done from degreemin to degreemax
0038   //! with a cutting if the corresponding boolean is True.
0039   Standard_EXPORT BRepFill_ComputeCLine(
0040     const BRepFill_MultiLine&     Line,
0041     const int                     degreemin   = 3,
0042     const int                     degreemax   = 8,
0043     const double                  Tolerance3d = 1.0e-5,
0044     const double                  Tolerance2d = 1.0e-5,
0045     const bool                    cutting     = false,
0046     const AppParCurves_Constraint FirstC      = AppParCurves_TangencyPoint,
0047     const AppParCurves_Constraint LastC       = AppParCurves_TangencyPoint);
0048 
0049   //! Initializes the fields of the algorithm.
0050   Standard_EXPORT BRepFill_ComputeCLine(
0051     const int                     degreemin   = 3,
0052     const int                     degreemax   = 8,
0053     const double                  Tolerance3d = 1.0e-05,
0054     const double                  Tolerance2d = 1.0e-05,
0055     const bool                    cutting     = false,
0056     const AppParCurves_Constraint FirstC      = AppParCurves_TangencyPoint,
0057     const AppParCurves_Constraint LastC       = AppParCurves_TangencyPoint);
0058 
0059   //! runs the algorithm after having initialized the fields.
0060   Standard_EXPORT void Perform(const BRepFill_MultiLine& Line);
0061 
0062   //! changes the degrees of the approximation.
0063   Standard_EXPORT void SetDegrees(const int degreemin, const int degreemax);
0064 
0065   //! Changes the tolerances of the approximation.
0066   Standard_EXPORT void SetTolerances(const double Tolerance3d, const double Tolerance2d);
0067 
0068   //! Changes the constraints of the approximation.
0069   Standard_EXPORT void SetConstraints(const AppParCurves_Constraint FirstC,
0070                                       const AppParCurves_Constraint LastC);
0071 
0072   //! Changes the max number of segments, which is allowed for cutting.
0073   Standard_EXPORT void SetMaxSegments(const int theMaxSegments);
0074 
0075   //! Set inverse order of degree selection:
0076   //! if theInvOrdr = true, current degree is chosen by inverse order -
0077   //! from maxdegree to mindegree.
0078   //! By default inverse order is used.
0079   Standard_EXPORT void SetInvOrder(const bool theInvOrder);
0080 
0081   //! Set value of hang checking flag
0082   //! if this flag = true, possible hang of algorithm is checked
0083   //! and algorithm is forced to stop.
0084   //! By default hang checking is used.
0085   Standard_EXPORT void SetHangChecking(const bool theHangChecking);
0086 
0087   //! returns False if at a moment of the approximation,
0088   //! the status NoApproximation has been sent by the user
0089   //! when more points were needed.
0090   Standard_EXPORT bool IsAllApproximated() const;
0091 
0092   //! returns False if the status NoPointsAdded has been sent.
0093   Standard_EXPORT bool IsToleranceReached() const;
0094 
0095   //! returns the tolerances 2d and 3d of the <Index> MultiCurve.
0096   Standard_EXPORT void Error(const int Index, double& tol3d, double& tol2d) const;
0097 
0098   //! Returns the number of MultiCurve doing the approximation
0099   //! of the MultiLine.
0100   Standard_EXPORT int NbMultiCurves() const;
0101 
0102   //! returns the approximation MultiCurve of range <Index>.
0103   Standard_EXPORT AppParCurves_MultiCurve Value(const int Index = 1) const;
0104 
0105   Standard_EXPORT void Parameters(const int Index, double& firstp, double& lastp) const;
0106 
0107 private:
0108   //! is internally used by the algorithms.
0109   Standard_EXPORT bool Compute(const BRepFill_MultiLine& Line,
0110                                const double              Ufirst,
0111                                const double              Ulast,
0112                                double&                   TheTol3d,
0113                                double&                   TheTol2d);
0114 
0115   NCollection_Sequence<AppParCurves_MultiCurve> myMultiCurves;
0116   NCollection_Sequence<double>                  myfirstparam;
0117   NCollection_Sequence<double>                  mylastparam;
0118   AppParCurves_MultiCurve                       TheMultiCurve;
0119   bool                                          alldone;
0120   bool                                          tolreached;
0121   NCollection_Sequence<double>                  Tolers3d;
0122   NCollection_Sequence<double>                  Tolers2d;
0123   int                                           mydegremin;
0124   int                                           mydegremax;
0125   double                                        mytol3d;
0126   double                                        mytol2d;
0127   double                                        currenttol3d;
0128   double                                        currenttol2d;
0129   bool                                          mycut;
0130   AppParCurves_Constraint                       myfirstC;
0131   AppParCurves_Constraint                       mylastC;
0132   int                                           myMaxSegments;
0133   bool                                          myInvOrder;
0134   bool                                          myHangChecking;
0135 };
0136 
0137 #endif // _BRepFill_ComputeCLine_HeaderFile