Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 1995-10-13
0002 // Created by: Laurent BOURESCHE
0003 // Copyright (c) 1995-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 _GeomFill_ConstrainedFilling_HeaderFile
0018 #define _GeomFill_ConstrainedFilling_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Integer.hxx>
0025 #include <GeomFill_CornerState.hxx>
0026 #include <gp_Vec.hxx>
0027 #include <TColgp_HArray1OfPnt.hxx>
0028 #include <TColStd_HArray1OfInteger.hxx>
0029 #include <TColStd_HArray1OfReal.hxx>
0030 #include <TColgp_HArray2OfPnt.hxx>
0031 class GeomFill_CoonsAlgPatch;
0032 class GeomFill_TgtField;
0033 class Geom_BSplineSurface;
0034 class GeomFill_Boundary;
0035 class GeomFill_BoundWithSurf;
0036 
0037 
0038 //! An algorithm for constructing a BSpline surface filled
0039 //! from a series of boundaries which serve as path
0040 //! constraints and optionally, as tangency constraints.
0041 //! The algorithm accepts three or four curves as the
0042 //! boundaries of the target surface.
0043 //! The only FillingStyle used is Coons.
0044 //! A ConstrainedFilling object provides a framework for:
0045 //! -   defining the boundaries of the surface
0046 //! -   implementing the construction algorithm
0047 //! -   consulting the result.
0048 //! Warning
0049 //! This surface filling algorithm is specifically designed to
0050 //! be used in connection with fillets. Satisfactory results
0051 //! cannot be guaranteed for other uses.
0052 class GeomFill_ConstrainedFilling 
0053 {
0054 public:
0055 
0056   DEFINE_STANDARD_ALLOC
0057 
0058   
0059 
0060   //! Constructs an empty framework for filling a surface from boundaries.
0061   //! The boundaries of the surface will be defined, and the
0062   //! surface will be built by using the function Init.
0063   //! The surface will respect the following constraints:
0064   //! -   its degree will not be greater than MaxDeg
0065   //! -   the maximum number of segments MaxSeg which
0066   //! BSpline surfaces can have.
0067   Standard_EXPORT GeomFill_ConstrainedFilling(const Standard_Integer MaxDeg, const Standard_Integer MaxSeg);
0068   
0069   Standard_EXPORT void Init (const Handle(GeomFill_Boundary)& B1, const Handle(GeomFill_Boundary)& B2, const Handle(GeomFill_Boundary)& B3, const Standard_Boolean NoCheck = Standard_False);
0070   
0071   //! Constructs a BSpline surface filled from the series of
0072   //! boundaries B1, B2, B3 and, if need be, B4, which serve:
0073   //! -   as path constraints
0074   //! -   and optionally, as tangency constraints if they are
0075   //! GeomFill_BoundWithSurf curves.
0076   //! The boundaries may be given in any order: they are
0077   //! classified and if necessary, reversed and reparameterized.
0078   //! The surface will also respect the following constraints:
0079   //! -   its degree will not be greater than the maximum
0080   //! degree defined at the time of construction of this framework, and
0081   //! -   the maximum number of segments MaxSeg which BSpline surfaces can have
0082   Standard_EXPORT void Init (const Handle(GeomFill_Boundary)& B1, const Handle(GeomFill_Boundary)& B2, const Handle(GeomFill_Boundary)& B3, const Handle(GeomFill_Boundary)& B4, const Standard_Boolean NoCheck = Standard_False);
0083   
0084   //! Allows to modify domain on witch the blending function
0085   //! associated to  the constrained boundary B  will propag
0086   //! the  influence   of the  field   of  tangency.  Can be
0087   //! useful to  reduce  influence of boundaries  on which
0088   //! the Coons compatibility  conditions are not respected.
0089   //! l is a  relative value of  the parametric range of  B.
0090   //! Default value for l is 1 (used in Init).
0091   //! Warning: Must be called after  Init with a constrained boundary
0092   //! used in the call to Init.
0093   Standard_EXPORT void SetDomain (const Standard_Real l, const Handle(GeomFill_BoundWithSurf)& B);
0094   
0095   //! Computes the  new poles  of  the surface using the  new
0096   //! blending  functions set by several calls to SetDomain.
0097   Standard_EXPORT void ReBuild();
0098   
0099   //! Returns the bound of index i after sort.
0100   Standard_EXPORT Handle(GeomFill_Boundary) Boundary (const Standard_Integer I) const;
0101   
0102   //! Returns the BSpline surface after computation of the fill by this framework.
0103   Standard_EXPORT Handle(Geom_BSplineSurface) Surface() const;
0104   
0105   //! Internal use for Advmath approximation call.
0106   Standard_EXPORT Standard_Integer Eval (const Standard_Real W, const Standard_Integer Ord, Standard_Real& Result) const;
0107   
0108   //! Computes the fields of tangents on 30 points along the
0109   //! bound  I, these  are  not the  constraint tangents but
0110   //! gives an idea of the coonsAlgPatch regularity.
0111   Standard_EXPORT void CheckCoonsAlgPatch (const Standard_Integer I);
0112   
0113   //! Computes  the fields  of tangents  and  normals on  30
0114   //! points along the bound  I, draw them, and computes the
0115   //! max dot product that must be near than 0.
0116   Standard_EXPORT void CheckTgteField (const Standard_Integer I);
0117   
0118   //! Computes  values  and normals  along  the bound  I and
0119   //! compare  them to the  approx  result curves (bound and
0120   //! tgte field) , draw  the normals and tangents.
0121   Standard_EXPORT void CheckApprox (const Standard_Integer I);
0122   
0123   //! Computes values and normals along the  bound I on both
0124   //! constraint  surface    and result  surface,  draw  the
0125   //! normals, and  computes the max distance between values
0126   //! and the max angle  between normals.
0127   Standard_EXPORT void CheckResult (const Standard_Integer I);
0128 
0129 
0130 
0131 
0132 protected:
0133 
0134 
0135 
0136 
0137 
0138 private:
0139 
0140   
0141   //! Performs the approximation an compute  the poles of the
0142   //! surface.
0143   Standard_EXPORT void Build();
0144   
0145   //! Performs  the  parallel approximation  on two  oppsite
0146   //! bounds
0147   Standard_EXPORT void PerformApprox();
0148   
0149   //! matches  the nodal vectors  of the  blending functions
0150   //! and the results  of the approx   to allow the  surface
0151   //! computation.
0152   Standard_EXPORT void MatchKnots();
0153   
0154   //! performs the poles of the partial construction S0.
0155   Standard_EXPORT void PerformS0();
0156   
0157   //! performs the poles of the partial construction S1.
0158   Standard_EXPORT void PerformS1();
0159   
0160   //! performs  the poles of  the  surface using the partial
0161   //! constructions S0 and S1.
0162   Standard_EXPORT void PerformSurface();
0163   
0164   //! Checks if the field of tangency doesn t twist along the
0165   //! boundary.
0166   Standard_EXPORT Standard_Boolean CheckTgte (const Standard_Integer I);
0167   
0168   //! Evaluates  the min magnitude  of  the field of tangency
0169   //! along bound  I  to allow a   simple evaluation of  the
0170   //! tolerance needed for the approximation of the field of
0171   //! tangency.
0172   Standard_EXPORT void MinTgte (const Standard_Integer I);
0173 
0174 
0175   Standard_Integer degmax;
0176   Standard_Integer segmax;
0177   Handle(GeomFill_CoonsAlgPatch) ptch;
0178   Handle(GeomFill_TgtField) tgalg[4];
0179   Standard_Real mig[4];
0180   GeomFill_CornerState stcor[4];
0181   gp_Vec v[4];
0182   Standard_Boolean appdone;
0183   Standard_Integer degree[2];
0184   Handle(TColgp_HArray1OfPnt) curvpol[4];
0185   Handle(TColgp_HArray1OfPnt) tgtepol[4];
0186   Handle(TColStd_HArray1OfInteger) mults[2];
0187   Handle(TColStd_HArray1OfReal) knots[2];
0188   Handle(TColStd_HArray1OfReal) ab[4];
0189   Handle(TColStd_HArray1OfReal) pq[4];
0190   Standard_Real dom[4];
0191   Handle(TColgp_HArray1OfPnt) ncpol[4];
0192   Handle(TColgp_HArray1OfPnt) ntpol[4];
0193   Handle(TColStd_HArray1OfInteger) nm[2];
0194   Handle(TColStd_HArray1OfReal) nk[2];
0195   Standard_Integer ibound[2];
0196   Standard_Integer ctr[2];
0197   Standard_Integer nbd3;
0198   Handle(TColgp_HArray2OfPnt) S0;
0199   Handle(TColgp_HArray2OfPnt) S1;
0200   Handle(Geom_BSplineSurface) surf;
0201 
0202 
0203 };
0204 
0205 
0206 
0207 
0208 
0209 
0210 
0211 #endif // _GeomFill_ConstrainedFilling_HeaderFile