Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-14 09:13:49

0001 // Created on: 1995-06-06
0002 // Created by: Jean Yves LEBEY
0003 // Copyright (c) 1995-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 _BRepApprox_Approx_HeaderFile
0018 #define _BRepApprox_Approx_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <NCollection_DynamicArray.hxx>
0025 #include <BRepApprox_TheComputeLineOfApprox.hxx>
0026 #include <BRepApprox_TheComputeLineBezierOfApprox.hxx>
0027 #include <Approx_MCurvesToBSpCurve.hxx>
0028 #include <Standard_Real.hxx>
0029 #include <Standard_Integer.hxx>
0030 #include <Approx_ParametrizationType.hxx>
0031 class Standard_OutOfRange;
0032 class StdFail_NotDone;
0033 class BRepAdaptor_Surface;
0034 class BRepApprox_SurfaceTool;
0035 class IntSurf_Quadric;
0036 class IntSurf_QuadricTool;
0037 class BRepApprox_ApproxLine;
0038 class BRepApprox_ThePrmPrmSvSurfacesOfApprox;
0039 class BRepApprox_TheInt2SOfThePrmPrmSvSurfacesOfApprox;
0040 class BRepApprox_TheImpPrmSvSurfacesOfApprox;
0041 class BRepApprox_TheZerImpFuncOfTheImpPrmSvSurfacesOfApprox;
0042 class BRepApprox_TheMultiLineOfApprox;
0043 class BRepApprox_TheMultiLineToolOfApprox;
0044 class BRepApprox_TheComputeLineOfApprox;
0045 class BRepApprox_MyBSplGradientOfTheComputeLineOfApprox;
0046 class BRepApprox_MyGradientbisOfTheComputeLineOfApprox;
0047 class BRepApprox_TheComputeLineBezierOfApprox;
0048 class BRepApprox_MyGradientOfTheComputeLineBezierOfApprox;
0049 class AppParCurves_MultiBSpCurve;
0050 
0051 class BRepApprox_Approx
0052 {
0053 private:
0054   struct Approx_Data
0055   {
0056     Approx_Data()
0057         : myBezierApprox(true),
0058           Xo(0.0),
0059           Yo(0.0),
0060           Zo(0.0),
0061           U1o(0.0),
0062           V1o(0.0),
0063           U2o(0.0),
0064           V2o(0.0),
0065           ApproxXYZ(true),
0066           ApproxU1V1(true),
0067           ApproxU2V2(true),
0068           indicemin(0),
0069           indicemax(0),
0070           myNbPntMax(30),
0071           parametrization(Approx_ChordLength)
0072     {
0073     }
0074 
0075     bool                       myBezierApprox;
0076     double                     Xo, Yo, Zo, U1o, V1o, U2o, V2o;
0077     bool                       ApproxXYZ, ApproxU1V1, ApproxU2V2;
0078     int                        indicemin, indicemax, myNbPntMax;
0079     Approx_ParametrizationType parametrization;
0080   };
0081 
0082 public:
0083   DEFINE_STANDARD_ALLOC
0084 
0085   Standard_EXPORT BRepApprox_Approx();
0086 
0087   Standard_EXPORT void Perform(const BRepAdaptor_Surface&                Surf1,
0088                                const BRepAdaptor_Surface&                Surf2,
0089                                const occ::handle<BRepApprox_ApproxLine>& aLine,
0090                                const bool                                ApproxXYZ  = true,
0091                                const bool                                ApproxU1V1 = true,
0092                                const bool                                ApproxU2V2 = true,
0093                                const int                                 indicemin  = 0,
0094                                const int                                 indicemax  = 0);
0095 
0096   Standard_EXPORT void Perform(const occ::handle<BRepApprox_ApproxLine>& aLine,
0097                                const bool                                ApproxXYZ  = true,
0098                                const bool                                ApproxU1V1 = true,
0099                                const bool                                ApproxU2V2 = true,
0100                                const int                                 indicemin  = 0,
0101                                const int                                 indicemax  = 0);
0102 
0103   Standard_EXPORT void SetParameters(
0104     const double                     Tol3d,
0105     const double                     Tol2d,
0106     const int                        DegMin,
0107     const int                        DegMax,
0108     const int                        NbIterMax,
0109     const int                        NbPntMax           = 30,
0110     const bool                       ApproxWithTangency = true,
0111     const Approx_ParametrizationType Parametrization    = Approx_ChordLength);
0112 
0113   Standard_EXPORT void Perform();
0114 
0115   Standard_EXPORT double TolReached3d() const;
0116 
0117   Standard_EXPORT double TolReached2d() const;
0118 
0119   Standard_EXPORT bool IsDone() const;
0120 
0121   Standard_EXPORT int NbMultiCurves() const;
0122 
0123   Standard_EXPORT const AppParCurves_MultiBSpCurve& Value(const int Index) const;
0124 
0125   Standard_EXPORT static void Parameters(const BRepApprox_TheMultiLineOfApprox& Line,
0126                                          const int                              firstP,
0127                                          const int                              lastP,
0128                                          const Approx_ParametrizationType       Par,
0129                                          math_Vector&                           TheParameters);
0130 
0131 private:
0132   Standard_EXPORT void Perform(const IntSurf_Quadric&                    Surf1,
0133                                const BRepAdaptor_Surface&                Surf2,
0134                                const occ::handle<BRepApprox_ApproxLine>& aLine,
0135                                const bool                                ApproxXYZ,
0136                                const bool                                ApproxU1V1,
0137                                const bool                                ApproxU2V2,
0138                                const int                                 indicemin,
0139                                const int                                 indicemax,
0140                                const bool                                isTheQuadFirst);
0141 
0142   Standard_EXPORT void UpdateTolReached();
0143 
0144   //! Fill data structure for intersection approximation.
0145   Standard_EXPORT void fillData(const occ::handle<BRepApprox_ApproxLine>& theLine);
0146 
0147   //! Prepare data structure for further computations.
0148   Standard_EXPORT void prepareDS(const bool theApproxXYZ,
0149                                  const bool theApproxU1V1,
0150                                  const bool theApproxU2V2,
0151                                  const int  indicemin,
0152                                  const int  indicemax);
0153 
0154   //! Build knot sequence.
0155   Standard_EXPORT void buildKnots(const occ::handle<BRepApprox_ApproxLine>& theline,
0156                                   void* const                               thePtrSVSurf);
0157 
0158   //! Build curve.
0159   Standard_EXPORT void buildCurve(const occ::handle<BRepApprox_ApproxLine>& theline,
0160                                   void* const                               thePtrSVSurf);
0161 
0162   BRepApprox_TheComputeLineOfApprox       myComputeLine;
0163   BRepApprox_TheComputeLineBezierOfApprox myComputeLineBezier;
0164   Approx_MCurvesToBSpCurve                myBezToBSpl;
0165   bool                                    myWithTangency;
0166   double                                  myTol3d;
0167   double                                  myTol2d;
0168   int                                     myDegMin;
0169   int                                     myDegMax;
0170   int                                     myNbIterMax;
0171   double                                  myTolReached3d;
0172   double                                  myTolReached2d;
0173   Approx_Data                             myData;
0174   NCollection_DynamicArray<int>           myKnots;
0175 };
0176 
0177 #endif // _BRepApprox_Approx_HeaderFile