/*!
* low level method that checks that the 2D cell is not a butterfly cell.
*/
-bool MEDCouplingPointSet::isButterfly2DCell(const std::vector<double>& res, bool isQuad)
+bool MEDCouplingPointSet::isButterfly2DCell(const std::vector<double>& res, bool isQuad, double eps)
{
std::size_t nbOfNodes=res.size()/2;
std::vector<INTERP_KERNEL::Node *> nodes(nbOfNodes);
INTERP_KERNEL::Node *tmp=new INTERP_KERNEL::Node(res[2*i],res[2*i+1]);
nodes[i]=tmp;
}
+ INTERP_KERNEL::QUADRATIC_PLANAR::_precision=eps;
+ INTERP_KERNEL::QUADRATIC_PLANAR::_arc_detection_precision=eps;
INTERP_KERNEL::QuadraticPolygon *pol=0;
if(isQuad)
pol=INTERP_KERNEL::QuadraticPolygon::BuildArcCirclePolygon(nodes);
else
pol=INTERP_KERNEL::QuadraticPolygon::BuildLinearPolygon(nodes);
- bool ret=pol->isButterfly();
+ bool ret=pol->isButterflyAbs();
delete pol;
return ret;
}
void rotate2D(const double *center, double angle);
void rotate3D(const double *center, const double *vect, double angle);
void project2DCellOnXY(const int *startConn, const int *endConn, std::vector<double>& res) const;
- static bool isButterfly2DCell(const std::vector<double>& res, bool isQuad);
+ static bool isButterfly2DCell(const std::vector<double>& res, bool isQuad, double eps);
template<int SPACEDIM>
void findNodeIdsNearPointAlg(std::vector<double>& bbox, const double *pos, int nbNodes, double eps,
std::vector<int>& c, std::vector<int>& cI) const;
* A 2D cell is considered to be butterfly if it exists at least one pair of distinct edges of it that intersect each other
* anywhere excepted their extremities. An INTERP_KERNEL::NORM_NORI3 could \b not be butterfly.
*/
-void MEDCouplingUMesh::checkButterflyCells(std::vector<int>& cells) const
+void MEDCouplingUMesh::checkButterflyCells(std::vector<int>& cells, double eps) const
{
const char msg[]="Butterfly detection work only for 2D cells with spaceDim==2 or 3!";
if(getMeshDimension()!=2)
continue;
bool isQuad=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[offset]).isQuadratic();
project2DCellOnXY(conn+offset+1,conn+connI[i+1],cell2DinS2);
- if(isButterfly2DCell(cell2DinS2,isQuad))
+ if(isButterfly2DCell(cell2DinS2,isQuad,eps))
cells.push_back(i);
cell2DinS2.clear();
}
MEDCOUPLING_EXPORT int getCellContainingPoint(const double *pos, double eps) const;
MEDCOUPLING_EXPORT void getCellsContainingPoint(const double *pos, double eps, std::vector<int>& elts) const;
MEDCOUPLING_EXPORT void getCellsContainingPoints(const double *pos, int nbOfPoints, double eps, std::vector<int>& elts, std::vector<int>& eltsIndex) const;
- MEDCOUPLING_EXPORT void checkButterflyCells(std::vector<int>& cells) const;
+ MEDCOUPLING_EXPORT void checkButterflyCells(std::vector<int>& cells, double eps=1e-12) const;
MEDCOUPLING_EXPORT void findAndCorrectBadOriented3DExtrudedCells(std::vector<int>& cells) throw(INTERP_KERNEL::Exception);
MEDCOUPLING_EXPORT void getBoundingBoxForBBTree(std::vector<double>& bbox) const;
MEDCOUPLING_EXPORT MEDCouplingUMesh *buildExtrudedMesh(const MEDCouplingUMesh *mesh1D, int policy);