Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-22 08:59:07

0001 // Created on: 1993-09-07
0002 // Created by: Bruno DUMORTIER
0003 // Copyright (c) 1993-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 _ProjLib_ComputeApprox_HeaderFile
0018 #define _ProjLib_ComputeApprox_HeaderFile
0019 
0020 #include <Adaptor3d_Curve.hxx>
0021 #include <Adaptor3d_Surface.hxx>
0022 #include <AppParCurves_Constraint.hxx>
0023 
0024 class Geom2d_BSplineCurve;
0025 class Geom2d_BezierCurve;
0026 
0027 //! Approximate the projection of a 3d curve on an
0028 //! analytic surface and stores the result in Approx.
0029 //! The result is a 2d curve.
0030 //! For approximation some parameters are used, including
0031 //! required tolerance of approximation.
0032 //! Tolerance is maximal possible value of 3d deviation of 3d projection of projected curve from
0033 //! "exact" 3d projection. Since algorithm searches 2d curve on surface, required 2d tolerance is
0034 //! computed from 3d tolerance with help of U,V resolutions of surface. 3d and 2d tolerances have
0035 //! sense only for curves on surface, it defines precision of projecting and approximation and have
0036 //! nothing to do with distance between the projected curve and the surface.
0037 class ProjLib_ComputeApprox
0038 {
0039 public:
0040   DEFINE_STANDARD_ALLOC
0041 
0042   //! Empty constructor, it only sets some initial values for class fields.
0043   Standard_EXPORT ProjLib_ComputeApprox();
0044 
0045   //! <Tol> is the tolerance with which the approximation is performed.
0046   //! Other parameters for approximation have default values.
0047   Standard_EXPORT ProjLib_ComputeApprox(const occ::handle<Adaptor3d_Curve>&   C,
0048                                         const occ::handle<Adaptor3d_Surface>& S,
0049                                         const double                          Tol);
0050 
0051   //! Performs projecting.
0052   //! In case of approximation current values of parameters are used:
0053   //! default values or set by corresponding methods Set...
0054   Standard_EXPORT void Perform(const occ::handle<Adaptor3d_Curve>&   C,
0055                                const occ::handle<Adaptor3d_Surface>& S);
0056 
0057   //! Set tolerance of approximation.
0058   //! Default value is Precision::Confusion().
0059   Standard_EXPORT void SetTolerance(const double theTolerance);
0060 
0061   //! Set min and max possible degree of result BSpline curve2d, which is got by approximation.
0062   //! If theDegMin/Max < 0, algorithm uses values that are chosen depending of types curve 3d
0063   //! and surface.
0064   Standard_EXPORT void SetDegree(const int theDegMin, const int theDegMax);
0065 
0066   //! Set the parameter, which defines maximal value of parametric intervals the projected
0067   //! curve can be cut for approximation. If theMaxSegments < 0, algorithm uses default
0068   //! value = 1000.
0069   Standard_EXPORT void SetMaxSegments(const int theMaxSegments);
0070 
0071   //! Set the parameter, which defines type of boundary condition between segments during
0072   //! approximation. It can be AppParCurves_PassPoint or AppParCurves_TangencyPoint. Default value
0073   //! is AppParCurves_TangencyPoint;
0074   Standard_EXPORT void SetBndPnt(const AppParCurves_Constraint theBndPnt);
0075 
0076   Standard_EXPORT occ::handle<Geom2d_BSplineCurve> BSpline() const;
0077 
0078   Standard_EXPORT occ::handle<Geom2d_BezierCurve> Bezier() const;
0079 
0080   //! returns the reached Tolerance.
0081   Standard_EXPORT double Tolerance() const;
0082 
0083 private:
0084   double                           myTolerance;
0085   occ::handle<Geom2d_BSplineCurve> myBSpline;
0086   occ::handle<Geom2d_BezierCurve>  myBezier;
0087   int                              myDegMin;
0088   int                              myDegMax;
0089   int                              myMaxSegments;
0090   AppParCurves_Constraint          myBndPnt;
0091 };
0092 
0093 #endif // _ProjLib_ComputeApprox_HeaderFile