Back to home page

EIC code displayed by LXR

 
 

    


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

0001 // Created on: 2016-07-07
0002 // Copyright (c) 2016 OPEN CASCADE SAS
0003 // Created by: Oleg AGASHIN
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _BRepMesh_NURBSRangeSplitter_HeaderFile
0017 #define _BRepMesh_NURBSRangeSplitter_HeaderFile
0018 
0019 #include <BRepMesh_UVParamRangeSplitter.hxx>
0020 #include <IMeshData_Types.hxx>
0021 #include <IMeshTools_Parameters.hxx>
0022 
0023 //! Auxiliary class extending UV range splitter in order to generate
0024 //! internal nodes for NURBS surface.
0025 class BRepMesh_NURBSRangeSplitter : public BRepMesh_UVParamRangeSplitter
0026 {
0027 public:
0028 
0029   //! Constructor.
0030   BRepMesh_NURBSRangeSplitter()
0031   : mySurfaceType(GeomAbs_OtherSurface)
0032   {
0033   }
0034 
0035   //! Destructor.
0036   virtual ~BRepMesh_NURBSRangeSplitter()
0037   {
0038   }
0039 
0040   //! Updates discrete range of surface according to its geometric range.
0041   Standard_EXPORT virtual void AdjustRange() Standard_OVERRIDE;
0042 
0043   //! Returns list of nodes generated using surface data and specified parameters.
0044   Standard_EXPORT virtual Handle(IMeshData::ListOfPnt2d) GenerateSurfaceNodes(
0045     const IMeshTools_Parameters& theParameters) const Standard_OVERRIDE;
0046 
0047 protected:
0048 
0049   //! Initializes U and V parameters lists using CN continuity intervals.
0050   Standard_EXPORT virtual Standard_Boolean initParameters() const;
0051 
0052   //! Returns number of intervals computed using available geometrical parameters.
0053   Standard_EXPORT virtual Standard_Integer getUndefinedIntervalNb(
0054     const Handle(Adaptor3d_Surface)& theSurface,
0055     const Standard_Boolean           isU,
0056     const GeomAbs_Shape              theContinuity) const;
0057 
0058 private:
0059   //! Tries to compute intervals even for cases with no intervals 
0060   //! at all using available geometrical parameters.
0061   void getUndefinedInterval(
0062     const Handle(Adaptor3d_Surface)&               theSurface,
0063     const Standard_Boolean                         isU,
0064     const GeomAbs_Shape                            theContinuity,
0065     const std::pair<Standard_Real, Standard_Real>& theRange,
0066     TColStd_Array1OfReal&                          theIntervals) const;
0067 
0068   //! Computes parameters of filter and applies it to the source parameters.
0069   Handle(IMeshData::SequenceOfReal) computeGrainAndFilterParameters(
0070     const IMeshData::IMapOfReal&            theSourceParams,
0071     const Standard_Real                     theTol2d,
0072     const Standard_Real                     theRangeDiff,
0073     const Standard_Real                     theDelta,
0074     const IMeshTools_Parameters&            theParameters,
0075     const Handle(NCollection_IncAllocator)& theAllocator) const;
0076 
0077   //! Filters parameters in order to avoid too dence distribution.
0078   Handle(IMeshData::SequenceOfReal) filterParameters(
0079     const IMeshData::IMapOfReal&            theParams,
0080     const Standard_Real                     theMinDist,
0081     const Standard_Real                     theFilterDist,
0082     const Handle(NCollection_IncAllocator)& theAllocator) const;
0083 
0084   enum EdgeType
0085   {
0086     Edge_Internal,
0087     Edge_Frontier
0088   };
0089 
0090   enum ParamDimension
0091   {
0092     Param_U = 0x1,
0093     Param_V = 0x2
0094   };
0095 
0096   //! Finds edges of discrete face and uses its points 
0097   //! as auxiliary control parameters for generation of nodes.
0098   Standard_Boolean grabParamsOfEdges (const EdgeType         theEdgeType,
0099                                       const Standard_Integer theParamDimensionFlag) const;
0100 
0101 private:
0102 
0103   GeomAbs_SurfaceType mySurfaceType;
0104 };
0105 
0106 #endif