Back to home page

EIC code displayed by LXR

 
 

    


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

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_Vector.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 () : myBezierApprox (Standard_True),
0057       Xo (0.0), Yo (0.0), Zo (0.0),
0058       U1o (0.0), V1o (0.0), U2o (0.0), V2o (0.0),
0059       ApproxXYZ (Standard_True),
0060       ApproxU1V1 (Standard_True),
0061       ApproxU2V2 (Standard_True),
0062       indicemin (0), indicemax (0),
0063       myNbPntMax (30), parametrization (Approx_ChordLength)
0064     {
0065     }
0066 
0067     Standard_Boolean myBezierApprox;
0068     Standard_Real  Xo, Yo, Zo, U1o, V1o, U2o, V2o;
0069     Standard_Boolean ApproxXYZ, ApproxU1V1, ApproxU2V2;
0070     Standard_Integer indicemin, indicemax, myNbPntMax;
0071     Approx_ParametrizationType parametrization;
0072   };
0073 
0074 
0075 public:
0076 
0077   DEFINE_STANDARD_ALLOC
0078 
0079   
0080   Standard_EXPORT BRepApprox_Approx();
0081   
0082   Standard_EXPORT void Perform (const BRepAdaptor_Surface& Surf1, const BRepAdaptor_Surface& Surf2, const Handle(BRepApprox_ApproxLine)& aLine, const Standard_Boolean ApproxXYZ = Standard_True, const Standard_Boolean ApproxU1V1 = Standard_True, const Standard_Boolean ApproxU2V2 = Standard_True, const Standard_Integer indicemin = 0, const Standard_Integer indicemax = 0);
0083   
0084   Standard_EXPORT void Perform (const Handle(BRepApprox_ApproxLine)& aLine, const Standard_Boolean ApproxXYZ = Standard_True, const Standard_Boolean ApproxU1V1 = Standard_True, const Standard_Boolean ApproxU2V2 = Standard_True, const Standard_Integer indicemin = 0, const Standard_Integer indicemax = 0);
0085   
0086   Standard_EXPORT 
0087       void SetParameters (const Standard_Real Tol3d, const Standard_Real Tol2d,
0088                           const Standard_Integer DegMin, 
0089                           const Standard_Integer DegMax,
0090                           const Standard_Integer NbIterMax,
0091                           const Standard_Integer NbPntMax = 30,
0092                           const Standard_Boolean ApproxWithTangency = Standard_True,
0093                           const Approx_ParametrizationType
0094                                           Parametrization = Approx_ChordLength);
0095 
0096   Standard_EXPORT void Perform();
0097   
0098   Standard_EXPORT Standard_Real TolReached3d() const;
0099   
0100   Standard_EXPORT Standard_Real TolReached2d() const;
0101   
0102   Standard_EXPORT Standard_Boolean IsDone() const;
0103   
0104   Standard_EXPORT Standard_Integer NbMultiCurves() const;
0105   
0106   Standard_EXPORT const AppParCurves_MultiBSpCurve& Value (const Standard_Integer Index) const;
0107 
0108   Standard_EXPORT static void Parameters(const BRepApprox_TheMultiLineOfApprox& Line,
0109     const Standard_Integer firstP,
0110     const Standard_Integer lastP,
0111     const Approx_ParametrizationType Par,
0112     math_Vector& TheParameters);
0113 
0114 
0115 
0116 protected:
0117 
0118 
0119 
0120 
0121 
0122 private:
0123   Standard_EXPORT void Perform (const IntSurf_Quadric& Surf1, const BRepAdaptor_Surface& Surf2, const Handle(BRepApprox_ApproxLine)& aLine, const Standard_Boolean ApproxXYZ, const Standard_Boolean ApproxU1V1, const Standard_Boolean ApproxU2V2, const Standard_Integer indicemin, const Standard_Integer indicemax, const Standard_Boolean isTheQuadFirst);
0124   
0125   Standard_EXPORT void UpdateTolReached();
0126 
0127   //! Fill data structure for intersection approximation.
0128   Standard_EXPORT void fillData(const Handle(BRepApprox_ApproxLine)& theLine);
0129 
0130   //! Prepare data structure for further computations.
0131   Standard_EXPORT void prepareDS(const Standard_Boolean theApproxXYZ,
0132                                  const Standard_Boolean theApproxU1V1,
0133                                  const Standard_Boolean theApproxU2V2,
0134                                  const Standard_Integer indicemin,
0135                                  const Standard_Integer indicemax);
0136 
0137   //! Build knot sequence.
0138   Standard_EXPORT void buildKnots(const Handle(BRepApprox_ApproxLine)& theline,
0139                                   const Standard_Address thePtrSVSurf);
0140 
0141   //! Build curve.
0142   Standard_EXPORT void buildCurve(const Handle(BRepApprox_ApproxLine)& theline,
0143                                   const Standard_Address thePtrSVSurf);
0144 
0145   BRepApprox_TheComputeLineOfApprox myComputeLine;
0146   BRepApprox_TheComputeLineBezierOfApprox myComputeLineBezier;
0147   Approx_MCurvesToBSpCurve myBezToBSpl;
0148   Standard_Boolean myWithTangency;
0149   Standard_Real myTol3d;
0150   Standard_Real myTol2d;
0151   Standard_Integer myDegMin;
0152   Standard_Integer myDegMax;
0153   Standard_Integer myNbIterMax;
0154   Standard_Real myTolReached3d;
0155   Standard_Real myTolReached2d;
0156   Approx_Data myData;
0157   NCollection_Vector<Standard_Integer> myKnots;
0158 
0159 };
0160 
0161 
0162 
0163 
0164 
0165 
0166 
0167 #endif // _BRepApprox_Approx_HeaderFile