1 // Created on: 1997-08-26 2 // Created by: Stepan MISHIN 3 // Copyright (c) 1997-1999 Matra Datavision 4 // Copyright (c) 1999-2014 OPEN CASCADE SAS 5 // 6 // This file is part of Open CASCADE Technology software library. 7 // 8 // This library is free software; you can redistribute it and/or modify it under 9 // the terms of the GNU Lesser General Public License version 2.1 as published 10 // by the Free Software Foundation, with special exception defined in the file 11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 12 // distribution for complete text of the license and disclaimer of any warranty. 13 // 14 // Alternatively, this file may be used under the terms of Open CASCADE 15 // commercial license or contractual agreement. 16 17 #ifndef _GeomConvert_ApproxSurface_HeaderFile 18 #define _GeomConvert_ApproxSurface_HeaderFile 19 20 #include <Adaptor3d_Surface.hxx> 21 #include <GeomAbs_Shape.hxx> 22 #include <Standard_OStream.hxx> 23 24 class Geom_BSplineSurface; 25 class Geom_Surface; 26 27 //! A framework to convert a surface to a BSpline 28 //! surface. This is done by approximation to a BSpline 29 //! surface within a given tolerance. 30 class GeomConvert_ApproxSurface 31 { 32 public: 33 34 DEFINE_STANDARD_ALLOC 35 36 37 //! Constructs a surface approximation framework defined by 38 //! - the conic Surf 39 //! - the tolerance value Tol3d 40 //! - the degree of continuity UContinuity, VContinuity 41 //! in the directions of the U and V parameters 42 //! - the highest degree MaxDegU, MaxDegV which 43 //! the polynomial defining the BSpline curve may 44 //! have in the directions of the U and V parameters 45 //! - the maximum number of segments MaxSegments 46 //! allowed in the resulting BSpline curve 47 //! - the index of precision PrecisCode. 48 Standard_EXPORT GeomConvert_ApproxSurface(const Handle(Geom_Surface)& Surf, const Standard_Real Tol3d, const GeomAbs_Shape UContinuity, const GeomAbs_Shape VContinuity, const Standard_Integer MaxDegU, const Standard_Integer MaxDegV, const Standard_Integer MaxSegments, const Standard_Integer PrecisCode); 49 50 //! Constructs a surface approximation framework defined by 51 //! - the Surf 52 //! - the tolerance value Tol3d 53 //! - the degree of continuity UContinuity, VContinuity 54 //! in the directions of the U and V parameters 55 //! - the highest degree MaxDegU, MaxDegV which 56 //! the polynomial defining the BSpline curve may 57 //! have in the directions of the U and V parameters 58 //! - the maximum number of segments MaxSegments 59 //! allowed in the resulting BSpline curve 60 //! - the index of precision PrecisCode. 61 Standard_EXPORT GeomConvert_ApproxSurface(const Handle(Adaptor3d_Surface)& Surf, const Standard_Real Tol3d, const GeomAbs_Shape UContinuity, const GeomAbs_Shape VContinuity, const Standard_Integer MaxDegU, const Standard_Integer MaxDegV, const Standard_Integer MaxSegments, const Standard_Integer PrecisCode); 62 63 //! Returns the BSpline surface resulting from the approximation algorithm. 64 Standard_EXPORT Handle(Geom_BSplineSurface) Surface() const; 65 66 //! Returns Standard_True if the approximation has be done 67 Standard_EXPORT Standard_Boolean IsDone() const; 68 69 //! Returns true if the approximation did come out with a result that 70 //! is not NECESSARILY within the required tolerance or a result 71 //! that is not recognized with the wished continuities. 72 Standard_EXPORT Standard_Boolean HasResult() const; 73 74 //! Returns the greatest distance between a point on the 75 //! source conic surface and the BSpline surface 76 //! resulting from the approximation (>0 when an approximation 77 //! has been done, 0 if no approximation ) 78 Standard_EXPORT Standard_Real MaxError() const; 79 80 //! Prints on the stream o information on the current state of the object. 81 Standard_EXPORT void Dump (Standard_OStream& o) const; 82 83 84 85 86 protected: 87 88 89 90 91 92 private: 93 94 95 //! Converts a surface to B-spline 96 Standard_EXPORT void Approximate (const Handle(Adaptor3d_Surface)& theSurf, const Standard_Real theTol3d, const GeomAbs_Shape theUContinuity, const GeomAbs_Shape theVContinuity, const Standard_Integer theMaxDegU, const Standard_Integer theMaxDegV, const Standard_Integer theMaxSegments, const Standard_Integer thePrecisCode); 97 98 99 Standard_Boolean myIsDone; 100 Standard_Boolean myHasResult; 101 Handle(Geom_BSplineSurface) myBSplSurf; 102 Standard_Real myMaxError; 103 104 105 }; 106 107 108 109 110 111 112 113 #endif // _GeomConvert_ApproxSurface_HeaderFile 114