X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHUtils%2FSMESH_Block.hxx;h=6b0caabbb7bae260816f1c612dc9d117fa76df13;hb=b7a7d49664daa32e1befb558280e13ed0bde37c9;hp=65c41bbec8e25858dd985fee27481da144bd1fc4;hpb=9a54694a0ab1e5cbc558a35c4606ceea4f7af2ef;p=modules%2Fsmesh.git diff --git a/src/SMESHUtils/SMESH_Block.hxx b/src/SMESHUtils/SMESH_Block.hxx index 65c41bbec..6b0caabbb 100644 --- a/src/SMESHUtils/SMESH_Block.hxx +++ b/src/SMESHUtils/SMESH_Block.hxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE // // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -6,7 +6,7 @@ // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either -// version 2.1 of the License. +// version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -68,20 +68,19 @@ class SMESHUtils_EXPORT SMESH_Block: public math_FunctionSetWithDerivatives // ---------------------------- ID_NONE = 0, - ID_V000 = 1, ID_V100, ID_V010, ID_V110, ID_V001, ID_V101, ID_V011, ID_V111, + ID_V000 = 1, ID_V100, ID_V010, ID_V110, ID_V001, ID_V101, ID_V011, ID_V111, // 1-8 - ID_Ex00, ID_Ex10, ID_Ex01, ID_Ex11, - ID_E0y0, ID_E1y0, ID_E0y1, ID_E1y1, - ID_E00z, ID_E10z, ID_E01z, ID_E11z, + ID_Ex00, ID_Ex10, ID_Ex01, ID_Ex11, // 9-12 + ID_E0y0, ID_E1y0, ID_E0y1, ID_E1y1, // 13-16 + ID_E00z, ID_E10z, ID_E01z, ID_E11z, // 17-20 - ID_Fxy0, ID_Fxy1, ID_Fx0z, ID_Fx1z, ID_F0yz, ID_F1yz, + ID_Fxy0, ID_Fxy1, ID_Fx0z, ID_Fx1z, ID_F0yz, ID_F1yz, // 21-26 - ID_Shell - }; - enum { // to use TShapeID for indexing certain type subshapes + ID_Shell, // 27 - ID_FirstV = ID_V000, ID_FirstE = ID_Ex00, ID_FirstF = ID_Fxy0 + // to use TShapeID for indexing certain type subshapes + ID_FirstV = ID_V000, ID_FirstE = ID_Ex00, ID_FirstF = ID_Fxy0 }; @@ -246,6 +245,8 @@ public: const gp_XYZ& theParamsHint = gp_XYZ(-1,-1,-1)); // compute point parameters in the block. // Note: for edges, it is better to use EdgeParameters() + // Return false only in case of "hard" failure, use IsToleranceReached() etc + // to evaluate quality of the found solution bool VertexParameters(const int theVertexID, gp_XYZ& theParams); // return parameters of a vertex given by TShapeID @@ -253,14 +254,18 @@ public: bool EdgeParameters(const int theEdgeID, const double theU, gp_XYZ& theParams); // return parameters of a point given by theU on edge + void SetTolerance(const double tol); + // set tolerance for ComputeParameters() - public: - // --------------- - // Block geometry - // --------------- + double GetTolerance() const { return myTolerance; } + // return current tolerance of ComputeParameters() + + bool IsToleranceReached() const; + // return true if solution found by ComputeParameters() is within the tolerance + + double DistanceReached() const { return distance(); } + // return distance between solution found by ComputeParameters() and thePoint - - public: // --------- // Services @@ -279,7 +284,7 @@ public: std::list< int > & theNbEdgesInWires, TopoDS_Vertex theFirstVertex=TopoDS_Vertex(), const bool theShapeAnalysisAlgo=false); - // Return nb wires and a list of oredered edges. + // Return nb wires and a list of ordered edges. // It is used to assign indices to subshapes. // theFirstVertex may be NULL. // Always try to set a seam edge first @@ -301,7 +306,7 @@ public: protected: /*! - * \brief Call it after geometry initialisation + * \brief Call it after geometry initialization */ void init(); @@ -309,7 +314,7 @@ public: // TFace, TEdge's and points for that face only // Note 2: curve adaptors need to have only Value(double), FirstParameter() and - // LastParameter() defined to be used by Block algoritms + // LastParameter() defined to be used by Block algorithms class SMESHUtils_EXPORT TEdge { int myCoordInd; @@ -352,6 +357,11 @@ public: int GetUInd() const { return myCoordInd[ 0 ]; } int GetVInd() const { return myCoordInd[ 2 ]; } void GetCoefs( int i, const gp_XYZ& theParams, double& eCoef, double& vCoef ) const; + const Adaptor3d_Surface* Surface() const { return myS; } + bool IsUVInQuad( const gp_XY& uv, + const gp_XYZ& param0, const gp_XYZ& param1, + const gp_XYZ& param2, const gp_XYZ& param3 ) const; + gp_XY GetUVRange() const; TFace(): myS(0) { myC2d[0]=myC2d[1]=myC2d[2]=myC2d[3]=0; } ~TFace(); }; @@ -369,7 +379,13 @@ public: enum { SQUARE_DIST = 0, DRV_1, DRV_2, DRV_3 }; double distance () const { return sqrt( myValues[ SQUARE_DIST ]); } double funcValue(double sqDist) const { return mySquareFunc ? sqDist : sqrt(sqDist); } - bool computeParameters(const gp_Pnt& thePoint, gp_XYZ& theParams, const gp_XYZ& theParamsHint); + bool computeParameters(const gp_Pnt& thePoint, gp_XYZ& theParams, const gp_XYZ& theParamsHint, int); + void refineParametersOnFace( const gp_Pnt& thePoint, gp_XYZ& theParams, int theFaceID ); + bool findUVByHalfDivision( const gp_Pnt& thePoint, const gp_XY& theUV, + const TFace& tface, gp_XYZ& theParams); + bool findUVAround( const gp_Pnt& thePoint, const gp_XY& theUV, + const TFace& tface, gp_XYZ& theParams, int nbGetWorstLimit ); + bool saveBetterSolution( const gp_XYZ& theNewParams, gp_XYZ& theParams, double sqDistance ); int myFaceIndex; double myFaceParam; @@ -383,7 +399,7 @@ public: double myValues[ 4 ]; // values computed at myParam: square distance and 3 derivatives typedef std::pair TxyzPair; - TxyzPair my3x3x3GridNodes[ 27 ]; // to compute the first param guess + TxyzPair my3x3x3GridNodes[ 1000 ]; // to compute the first param guess bool myGridComputed; };