X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FINTERP_KERNEL%2FPolygonAlgorithms.txx;h=bf606e92670e28092bc585af69afa95157e82212;hb=19a5d11f2c31745a83bd6993357263641c0babe5;hp=74fe484ae05969307fbae47c802a64fef17c3338;hpb=48782c06022ca2caa36f849cb5a29ea4fe2aaa83;p=tools%2Fmedcoupling.git diff --git a/src/INTERP_KERNEL/PolygonAlgorithms.txx b/src/INTERP_KERNEL/PolygonAlgorithms.txx index 74fe484ae..bf606e926 100644 --- a/src/INTERP_KERNEL/PolygonAlgorithms.txx +++ b/src/INTERP_KERNEL/PolygonAlgorithms.txx @@ -1,20 +1,20 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D +// Copyright (C) 2007-2016 CEA/DEN, EDF R&D // -// 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. +// 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, 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 -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #ifndef __POLYGONALGORITHMS_TXX__ #define __POLYGONALGORITHMS_TXX__ @@ -37,7 +37,7 @@ namespace INTERP_KERNEL /*************************************************************/ /* Computes the 3D intersection between two COPLANAR */ /* Segments [A,B] and [C,D], stores the result in V. */ - /* If A belongs to [CD] then the vertex E (preceeding A) */ + /* If A belongs to [CD] then the vertex E (preceding A) */ /* is used to decide if the crossing is real. If A coincides */ /* with C or D, a special treatment is performed */ /*************************************************************/ @@ -71,30 +71,30 @@ namespace INTERP_KERNEL { if(distance2(A,D)<_epsilon) crossprod(A,C,E,_vdouble);//store the crossprod between vectors AC and AE (E=vertex preceding A) - return false;//case of paralell segments + return false;//case of parallel segments } case 3://beware AB and CD may belong to a vertical plane det = determinant(&AB[1],&DC[1]);//determinant of the last two coefficients if(fabs(det) > _epsilon) { inv_det = 1/det; - t1=(AC[1]*DC[2]-AC[2]*DC[1])*inv_det; - t2=(AB[1]*AC[2]-AB[2]*AC[1])*inv_det; + t1=(AC[1]*DC[DIM-1]-AC[DIM-1]*DC[1])*inv_det; + t2=(AB[1]*AC[DIM-1]-AB[DIM-1]*AC[1])*inv_det; } else //beware AB and CD may belong to a plane y = constant { - det = AB[0]*DC[2]-AB[2]*DC[0]; + det = AB[0]*DC[DIM-1]-AB[DIM-1]*DC[0]; if(fabs(det) > _epsilon) { inv_det = 1/det; - t1=(AC[0]*DC[2]-AC[2]*DC[0])*inv_det; - t2=(AB[0]*AC[2]-AB[2]*AC[0])*inv_det; + t1=(AC[0]*DC[DIM-1]-AC[DIM-1]*DC[0])*inv_det; + t2=(AB[0]*AC[DIM-1]-AB[DIM-1]*AC[0])*inv_det; } else { if(distance2(A,D)<_epsilon) crossprod(A,C,E,_vdouble);//store the crossprod between vectors AC and AE (E=vertex preceding A) - return false;//case of paralell segments + return false;//case of parallel segments } } } @@ -269,7 +269,7 @@ namespace INTERP_KERNEL /*******************************************************/ /* adds the possible crossings between segments [A,B] (with end-point global indices i and i_next) */ /*and segments [C,D] and [E,F] to the list inter and updates _End_segments */ - /* In cases of ambiguity, the vertex G is used to decide wether the crossing should be accepted */ + /* In cases of ambiguity, the vertex G is used to decide whether the crossing should be accepted */ /*******************************************************/ template inline void PolygonAlgorithms::addCrossings( const double * A, const double * B, int i , int i_next, @@ -490,8 +490,10 @@ namespace INTERP_KERNEL break; case 2 : if(!_Inter.empty()) - if(i_glob < N1) for(idim=0;idim