Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:02:58

0001 // Created on: 1997-06-24
0002 // Created by: Philippe MANGIN
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 _Approx_SweepApproximation_HeaderFile
0018 #define _Approx_SweepApproximation_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Integer.hxx>
0025 #include <TColgp_HArray2OfPnt.hxx>
0026 #include <TColStd_HArray2OfReal.hxx>
0027 #include <TColStd_HArray1OfReal.hxx>
0028 #include <TColStd_HArray1OfInteger.hxx>
0029 #include <TColgp_SequenceOfArray1OfPnt2d.hxx>
0030 #include <Approx_HArray1OfGTrsf2d.hxx>
0031 #include <gp_Vec.hxx>
0032 #include <TColgp_HArray1OfPnt.hxx>
0033 #include <TColgp_HArray1OfPnt2d.hxx>
0034 #include <TColgp_HArray1OfVec.hxx>
0035 #include <TColgp_HArray1OfVec2d.hxx>
0036 #include <GeomAbs_Shape.hxx>
0037 #include <AdvApprox_EvaluatorFunction.hxx>
0038 #include <TColgp_Array2OfPnt.hxx>
0039 #include <TColStd_Array2OfReal.hxx>
0040 #include <TColStd_Array1OfReal.hxx>
0041 #include <TColStd_Array1OfInteger.hxx>
0042 #include <TColgp_Array1OfPnt2d.hxx>
0043 #include <Standard_OStream.hxx>
0044 class Approx_SweepFunction;
0045 class AdvApprox_Cutting;
0046 
0047 
0048 //! Approximation  of  an  Surface   S(u,v)
0049 //! (and eventually associate  2d Curves) defined
0050 //! by section's law.
0051 //!
0052 //! This surface is defined by a function F(u, v)
0053 //! where Ft(u) = F(u, t) is a bspline curve.
0054 //! To use this algorithme, you  have to implement Ft(u)
0055 //! as a derivative class  of Approx_SweepFunction.
0056 //! This algorithm can be used by blending, sweeping...
0057 class Approx_SweepApproximation 
0058 {
0059 public:
0060 
0061   DEFINE_STANDARD_ALLOC
0062 
0063   
0064   Standard_EXPORT Approx_SweepApproximation(const Handle(Approx_SweepFunction)& Func);
0065   
0066   //! Perform the Approximation
0067   //! [First, Last] : Approx_SweepApproximation.cdl
0068   //! Tol3d : Tolerance to surface approximation
0069   //! Tol2d : Tolerance used to perform curve approximation
0070   //! Normally the 2d curve are approximated with a
0071   //! tolerance given by the resolution on support surfaces,
0072   //! but if this tolerance is too large Tol2d is used.
0073   //! TolAngular : Tolerance (in radian) to control the angle
0074   //! between tangents on the section law and
0075   //! tangent of iso-v on approximated surface
0076   //! Continuity : The continuity in v waiting on the surface
0077   //! Degmax     : The maximum degree in v required on the surface
0078   //! Segmax     : The maximum number of span in v required on
0079   //! the surface
0080   //! Warning : The continuity ci can be obtained only if Ft is Ci
0081   Standard_EXPORT void Perform (const Standard_Real First, const Standard_Real Last, const Standard_Real Tol3d, const Standard_Real BoundTol, const Standard_Real Tol2d, const Standard_Real TolAngular, const GeomAbs_Shape Continuity = GeomAbs_C0, const Standard_Integer Degmax = 11, const Standard_Integer Segmax = 50);
0082   
0083   //! The EvaluatorFunction from AdvApprox;
0084   Standard_EXPORT Standard_Integer Eval (const Standard_Real Parameter, const Standard_Integer DerivativeRequest, const Standard_Real First, const Standard_Real Last, Standard_Real& Result);
0085   
0086   //! returns if we have an result
0087     Standard_Boolean IsDone() const;
0088   
0089   Standard_EXPORT void SurfShape (Standard_Integer& UDegree, Standard_Integer& VDegree, Standard_Integer& NbUPoles, Standard_Integer& NbVPoles, Standard_Integer& NbUKnots, Standard_Integer& NbVKnots) const;
0090   
0091   Standard_EXPORT void Surface (TColgp_Array2OfPnt& TPoles, TColStd_Array2OfReal& TWeights, TColStd_Array1OfReal& TUKnots, TColStd_Array1OfReal& TVKnots, TColStd_Array1OfInteger& TUMults, TColStd_Array1OfInteger& TVMults) const;
0092   
0093     Standard_Integer UDegree() const;
0094   
0095     Standard_Integer VDegree() const;
0096   
0097     const TColgp_Array2OfPnt& SurfPoles() const;
0098   
0099     const TColStd_Array2OfReal& SurfWeights() const;
0100   
0101     const TColStd_Array1OfReal& SurfUKnots() const;
0102   
0103     const TColStd_Array1OfReal& SurfVKnots() const;
0104   
0105     const TColStd_Array1OfInteger& SurfUMults() const;
0106   
0107     const TColStd_Array1OfInteger& SurfVMults() const;
0108   
0109   //! returns the maximum error in the surface approximation.
0110   Standard_EXPORT Standard_Real MaxErrorOnSurf() const;
0111   
0112   //! returns the average error in the surface approximation.
0113   Standard_EXPORT Standard_Real AverageErrorOnSurf() const;
0114   
0115     Standard_Integer NbCurves2d() const;
0116   
0117   Standard_EXPORT void Curves2dShape (Standard_Integer& Degree, Standard_Integer& NbPoles, Standard_Integer& NbKnots) const;
0118   
0119   Standard_EXPORT void Curve2d (const Standard_Integer Index, TColgp_Array1OfPnt2d& TPoles, TColStd_Array1OfReal& TKnots, TColStd_Array1OfInteger& TMults) const;
0120   
0121     Standard_Integer Curves2dDegree() const;
0122   
0123     const TColgp_Array1OfPnt2d& Curve2dPoles (const Standard_Integer Index) const;
0124   
0125     const TColStd_Array1OfReal& Curves2dKnots() const;
0126   
0127     const TColStd_Array1OfInteger& Curves2dMults() const;
0128   
0129   //! returns the maximum error of the <Index>
0130   //! 2d curve approximation.
0131   Standard_EXPORT Standard_Real Max2dError (const Standard_Integer Index) const;
0132   
0133   //! returns the average error of the <Index>
0134   //! 2d curve approximation.
0135   Standard_EXPORT Standard_Real Average2dError (const Standard_Integer Index) const;
0136   
0137   //! returns the  maximum 3d  error  of the  <Index>
0138   //! 2d curve approximation on the Surface.
0139   Standard_EXPORT Standard_Real TolCurveOnSurf (const Standard_Integer Index) const;
0140   
0141   //! display information on approximation.
0142   Standard_EXPORT void Dump (Standard_OStream& o) const;
0143 
0144 
0145 
0146 
0147 protected:
0148 
0149 
0150 
0151 
0152 
0153 private:
0154 
0155   
0156   Standard_EXPORT void Approximation (const Handle(TColStd_HArray1OfReal)& OneDTol, const Handle(TColStd_HArray1OfReal)& TwoDTol, const Handle(TColStd_HArray1OfReal)& ThreeDTol, const Standard_Real BounTol, const Standard_Real First, const Standard_Real Last, const GeomAbs_Shape Continuity, const Standard_Integer Degmax, const Standard_Integer Segmax, const AdvApprox_EvaluatorFunction& TheApproxFunction, const AdvApprox_Cutting& TheCuttingTool);
0157   
0158   Standard_EXPORT Standard_Boolean D0 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, Standard_Real& Result);
0159   
0160   Standard_EXPORT Standard_Boolean D1 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, Standard_Real& Result);
0161   
0162   Standard_EXPORT Standard_Boolean D2 (const Standard_Real Param, const Standard_Real First, const Standard_Real Last, Standard_Real& Result);
0163 
0164 
0165   Handle(Approx_SweepFunction) myFunc;
0166   Standard_Boolean done;
0167   Standard_Integer Num1DSS;
0168   Standard_Integer Num2DSS;
0169   Standard_Integer Num3DSS;
0170   Standard_Integer udeg;
0171   Standard_Integer vdeg;
0172   Standard_Integer deg2d;
0173   Handle(TColgp_HArray2OfPnt) tabPoles;
0174   Handle(TColStd_HArray2OfReal) tabWeights;
0175   Handle(TColStd_HArray1OfReal) tabUKnots;
0176   Handle(TColStd_HArray1OfReal) tabVKnots;
0177   Handle(TColStd_HArray1OfReal) tab2dKnots;
0178   Handle(TColStd_HArray1OfInteger) tabUMults;
0179   Handle(TColStd_HArray1OfInteger) tabVMults;
0180   Handle(TColStd_HArray1OfInteger) tab2dMults;
0181   TColgp_SequenceOfArray1OfPnt2d seqPoles2d;
0182   Handle(TColStd_HArray1OfReal) MError1d;
0183   Handle(TColStd_HArray1OfReal) tab2dError;
0184   Handle(TColStd_HArray1OfReal) MError3d;
0185   Handle(TColStd_HArray1OfReal) AError1d;
0186   Handle(TColStd_HArray1OfReal) Ave2dError;
0187   Handle(TColStd_HArray1OfReal) AError3d;
0188   Handle(Approx_HArray1OfGTrsf2d) AAffin;
0189   Handle(TColStd_HArray1OfReal) COnSurfErr;
0190   gp_Vec Translation;
0191   Handle(TColgp_HArray1OfPnt) myPoles;
0192   Handle(TColgp_HArray1OfPnt2d) myPoles2d;
0193   Handle(TColStd_HArray1OfReal) myWeigths;
0194   Handle(TColgp_HArray1OfVec) myDPoles;
0195   Handle(TColgp_HArray1OfVec) myD2Poles;
0196   Handle(TColgp_HArray1OfVec2d) myDPoles2d;
0197   Handle(TColgp_HArray1OfVec2d) myD2Poles2d;
0198   Handle(TColStd_HArray1OfReal) myDWeigths;
0199   Handle(TColStd_HArray1OfReal) myD2Weigths;
0200   Standard_Integer myOrder;
0201   Standard_Real myParam;
0202   Standard_Real first;
0203   Standard_Real last;
0204 
0205 
0206 };
0207 
0208 
0209 #include <Approx_SweepApproximation.lxx>
0210 
0211 
0212 
0213 
0214 
0215 #endif // _Approx_SweepApproximation_HeaderFile