Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-06 09:20:28

0001 // Created on: 1997-08-26
0002 // Created by: Stepan MISHIN
0003 // Copyright (c) 1997-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 _GeomConvert_ApproxSurface_HeaderFile
0018 #define _GeomConvert_ApproxSurface_HeaderFile
0019 
0020 #include <Adaptor3d_Surface.hxx>
0021 #include <GeomAbs_Shape.hxx>
0022 #include <Standard_OStream.hxx>
0023 
0024 class Geom_BSplineSurface;
0025 class Geom_Surface;
0026 
0027 //! A framework to convert a surface to a BSpline
0028 //! surface. This is done by approximation to a BSpline
0029 //! surface within a given tolerance.
0030 class GeomConvert_ApproxSurface
0031 {
0032 public:
0033   DEFINE_STANDARD_ALLOC
0034 
0035   //! Constructs a surface approximation framework defined by
0036   //! -   the conic Surf
0037   //! -   the tolerance value Tol3d
0038   //! -   the degree of continuity UContinuity, VContinuity
0039   //! in the directions of the U and V parameters
0040   //! -   the highest degree MaxDegU, MaxDegV which
0041   //! the polynomial defining the BSpline curve may
0042   //! have in the directions of the U and V parameters
0043   //! -   the maximum number of segments MaxSegments
0044   //! allowed in the resulting BSpline curve
0045   //! -   the index of precision PrecisCode.
0046   Standard_EXPORT GeomConvert_ApproxSurface(const occ::handle<Geom_Surface>& Surf,
0047                                             const double                     Tol3d,
0048                                             const GeomAbs_Shape              UContinuity,
0049                                             const GeomAbs_Shape              VContinuity,
0050                                             const int                        MaxDegU,
0051                                             const int                        MaxDegV,
0052                                             const int                        MaxSegments,
0053                                             const int                        PrecisCode);
0054 
0055   //! Constructs a surface approximation framework defined by
0056   //! -   the Surf
0057   //! -   the tolerance value Tol3d
0058   //! -   the degree of continuity UContinuity, VContinuity
0059   //! in the directions of the U and V parameters
0060   //! -   the highest degree MaxDegU, MaxDegV which
0061   //! the polynomial defining the BSpline curve may
0062   //! have in the directions of the U and V parameters
0063   //! -   the maximum number of segments MaxSegments
0064   //! allowed in the resulting BSpline curve
0065   //! -   the index of precision PrecisCode.
0066   Standard_EXPORT GeomConvert_ApproxSurface(const occ::handle<Adaptor3d_Surface>& Surf,
0067                                             const double                          Tol3d,
0068                                             const GeomAbs_Shape                   UContinuity,
0069                                             const GeomAbs_Shape                   VContinuity,
0070                                             const int                             MaxDegU,
0071                                             const int                             MaxDegV,
0072                                             const int                             MaxSegments,
0073                                             const int                             PrecisCode);
0074 
0075   //! Returns the BSpline surface resulting from the approximation algorithm.
0076   Standard_EXPORT occ::handle<Geom_BSplineSurface> Surface() const;
0077 
0078   //! Returns true if the approximation has be done
0079   Standard_EXPORT bool IsDone() const;
0080 
0081   //! Returns true if the approximation did come out with a result that
0082   //! is not NECESSARILY within the required tolerance or a result
0083   //! that is not recognized with the wished continuities.
0084   Standard_EXPORT bool HasResult() const;
0085 
0086   //! Returns the greatest distance between a point on the
0087   //! source conic surface and the BSpline surface
0088   //! resulting from the approximation (>0 when an approximation
0089   //! has been done, 0 if no  approximation )
0090   Standard_EXPORT double MaxError() const;
0091 
0092   //! Prints on the stream o information on the current state of the object.
0093   Standard_EXPORT void Dump(Standard_OStream& o) const;
0094 
0095 private:
0096   //! Converts a surface to B-spline
0097   Standard_EXPORT void Approximate(const occ::handle<Adaptor3d_Surface>& theSurf,
0098                                    const double                          theTol3d,
0099                                    const GeomAbs_Shape                   theUContinuity,
0100                                    const GeomAbs_Shape                   theVContinuity,
0101                                    const int                             theMaxDegU,
0102                                    const int                             theMaxDegV,
0103                                    const int                             theMaxSegments,
0104                                    const int                             thePrecisCode);
0105 
0106   bool                             myIsDone;
0107   bool                             myHasResult;
0108   occ::handle<Geom_BSplineSurface> myBSplSurf;
0109   double                           myMaxError;
0110 };
0111 
0112 #endif // _GeomConvert_ApproxSurface_HeaderFile