template<mcIdType SPACEDIM>
void DataArrayDouble::FindClosestTupleIdAlg(const BBTreePts<SPACEDIM,mcIdType>& myTree, double dist, const double *pos, mcIdType nbOfTuples, const double *thisPt, mcIdType thisNbOfTuples, mcIdType *res)
{
- double distOpt(dist);
+ double distOpt = std::max(dist, std::numeric_limits<double>::epsilon());
+ //double distOpt(dist);
const double *p(pos);
mcIdType *r(res);
for(mcIdType i=0;i<nbOfTuples;i++,p+=SPACEDIM,r++)
#
ids3=ptsi.findClosestTupleId(d2i)
idsExpected3=idsExpected2.deepCopy() ; idsExpected3.reverse()
- self.assertTrue(idsExpected3.isEqual(ids3))
+ self.assertTrue(idsExpected3.isEqual(ids3))
+
+ #
+ ones = [1.0]*nbPt
+ twos = [2.0]*nbPt
+ d3=DataArrayDouble.Meld( DataArrayDouble(ones), DataArrayDouble(twos) )
+ d4=DataArrayDouble.Meld( DataArrayDouble(ones), DataArrayDouble(ones) )
+ idsExpected4 = DataArrayInt([0]*nbPt)
+ ids4 = d3.findClosestTupleId(d4)
+ self.assertTrue(idsExpected.isEqual(ids))
pass
+
+
def testSwig2DataArrayAsciiChar1(self):
alpha=DataArrayInt(26) ; alpha.iota(ord("A"))