X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHUtils%2FSMESH_Block.cxx;h=4f7bc42cfe03790bece2f80f7625f8512a720a4a;hb=7084b4f9799cf4a0145ba86ab8b653de8f2d2bdb;hp=7d2ed2a7127da1630f6cb0586ea11dc6761197a0;hpb=620c78e5828d820e90b32b79e5830ead4fd274bc;p=modules%2Fsmesh.git diff --git a/src/SMESHUtils/SMESH_Block.cxx b/src/SMESHUtils/SMESH_Block.cxx index 7d2ed2a71..4f7bc42cf 100644 --- a/src/SMESHUtils/SMESH_Block.cxx +++ b/src/SMESHUtils/SMESH_Block.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2013 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 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 @@ -26,6 +26,11 @@ // #include "SMESH_Block.hxx" +#include "SMDS_MeshNode.hxx" +#include "SMDS_MeshVolume.hxx" +#include "SMDS_VolumeTool.hxx" +#include "SMESH_MeshAlgos.hxx" + #include #include #include @@ -56,10 +61,7 @@ #include #include -#include "SMDS_MeshNode.hxx" -#include "SMDS_MeshVolume.hxx" -#include "SMDS_VolumeTool.hxx" -#include "utilities.h" +#include #include #include @@ -309,24 +311,15 @@ gp_XYZ SMESH_Block::TFace::Point( const gp_XYZ& theParams ) const namespace { + inline bool isPntInTria( const gp_XY& p, const gp_XY& t0, const gp_XY& t1, const gp_XY& t2 ) { - const double // matrix 2x2 - T11 = t0.X()-t2.X(), T12 = t1.X()-t2.X(), - T21 = t0.Y()-t2.Y(), T22 = t1.Y()-t2.Y(); - const double Tdet = T11*T22 - T12*T21; // matrix determinant - if ( Abs( Tdet ) < std::numeric_limits::min() ) - return false; - // matrix inverse - const double t11 = T22, t12 = -T12, t21 = -T21, t22 = T11; - // vector - const double r11 = p.X()-t2.X(), r12 = p.Y()-t2.Y(); - // barycentric coordinates: mutiply matrix by vector - const double bc0 = (t11 * r11 + t12 * r12)/Tdet; - const double bc1 = (t21 * r11 + t22 * r12)/Tdet; + double bc0, bc1; + SMESH_MeshAlgos::GetBarycentricCoords( p, t0, t1, t2, bc0, bc1 ); return ( bc0 >= 0. && bc1 >= 0. && bc0 + bc1 <= 1. ); } + inline bool isPntInQuad( const gp_XY& p, const gp_XY& q0, const gp_XY& q1, const gp_XY& q2, const gp_XY& q3 ) { @@ -603,6 +596,7 @@ Standard_Boolean SMESH_Block::Values(const math_Vector& theXYZ, if ( mag > DBL_MIN ) dPi /= mag; drv[ iP - 1 ] = dPi; + // drv[ iP - 1 ] = dPi / 0.001; } for ( int iP = 0; iP < 3; iP++ ) { #if 1 @@ -732,7 +726,7 @@ bool SMESH_Block::ComputeParameters(const gp_Pnt& thePoint, bool hasHint = ( 0 <= theParamsHint.X() && theParamsHint.X() <= 1 && 0 <= theParamsHint.Y() && theParamsHint.Y() <= 1 && - 0 <= theParamsHint.Y() && theParamsHint.Y() <= 1 ); + 0 <= theParamsHint.Z() && theParamsHint.Z() <= 1 ); if ( !hasHint && !myGridComputed ) { // define the first guess by thePoint projection on lines @@ -1471,7 +1465,7 @@ int SMESH_Block::GetShapeIDByParams ( const gp_XYZ& theCoord ) /*! * \brief Return number of wires and a list of oredered edges. * \param theFace - the face to process - * \param theEdges - all ordered edges of theFace (outer edges goes first). + * \param theEdges - all ordered edges of theFace (outer edges go first). * \param theNbEdgesInWires - nb of edges (== nb of vertices in closed wire) in each wire * \param theFirstVertex - the vertex of the outer wire to set first in the returned * list ( theFirstVertex may be NULL )