Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:39

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 computed
0034 //! from 3d tolerance with help of U,V resolutions of surface.
0035 //! 3d and 2d tolerances have sense only for curves on surface, it defines precision of projecting and approximation
0036 //! and have nothing to do with distance between the projected curve and the surface.
0037 class ProjLib_ComputeApprox 
0038 {
0039 public:
0040 
0041   DEFINE_STANDARD_ALLOC
0042 
0043   //! Empty constructor, it only sets some initial values for class fields.
0044   Standard_EXPORT ProjLib_ComputeApprox();
0045    
0046   //! <Tol>    is   the   tolerance   with  which    the
0047   //! approximation is performed.
0048   //! Other parameters for approximation have default values.
0049   Standard_EXPORT ProjLib_ComputeApprox(const Handle(Adaptor3d_Curve)& C, const Handle(Adaptor3d_Surface)& S, const Standard_Real 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 Handle(Adaptor3d_Curve)& C, const Handle(Adaptor3d_Surface)& S);
0055 
0056   //! Set tolerance of approximation.
0057   //! Default value is Precision::Confusion().
0058   Standard_EXPORT void SetTolerance(const Standard_Real theTolerance);
0059 
0060   //! Set min and max possible degree of result BSpline curve2d, which is got by approximation.
0061   //! If theDegMin/Max < 0, algorithm uses values that are chosen depending of types curve 3d
0062   //! and surface.
0063   Standard_EXPORT void SetDegree(const Standard_Integer theDegMin, const Standard_Integer theDegMax);
0064 
0065   //! Set the parameter, which defines maximal value of parametric intervals the projected
0066   //! curve can be cut for approximation. If theMaxSegments < 0, algorithm uses default 
0067   //! value = 1000.
0068   Standard_EXPORT void SetMaxSegments(const Standard_Integer theMaxSegments);
0069 
0070   //! Set the parameter, which defines type of boundary condition between segments during approximation.
0071   //! It can be AppParCurves_PassPoint or AppParCurves_TangencyPoint.
0072   //! Default value is AppParCurves_TangencyPoint;
0073   Standard_EXPORT void SetBndPnt(const AppParCurves_Constraint theBndPnt);
0074 
0075   Standard_EXPORT Handle(Geom2d_BSplineCurve) BSpline() const;
0076   
0077   Standard_EXPORT Handle(Geom2d_BezierCurve) Bezier() const;
0078   
0079   //! returns the reached Tolerance.
0080   Standard_EXPORT Standard_Real Tolerance() const;
0081 
0082 
0083 
0084 
0085 protected:
0086 
0087 
0088 
0089 
0090 
0091 private:
0092 
0093   Standard_Real myTolerance;
0094   Handle(Geom2d_BSplineCurve) myBSpline;
0095   Handle(Geom2d_BezierCurve) myBezier;
0096   Standard_Integer myDegMin;
0097   Standard_Integer myDegMax;
0098   Standard_Integer myMaxSegments;
0099   AppParCurves_Constraint myBndPnt;
0100 
0101 };
0102 
0103 
0104 
0105 
0106 
0107 
0108 
0109 #endif // _ProjLib_ComputeApprox_HeaderFile