Skip to content

gtsSurfaceBestFitOBB() broken

Hello,

It seems the pack.gtsSurfaceBestFitOBB() function is broken in recent YADE versions. Just type the following (using a gts file present in the sources) in your YADE terminal:

******************************
import gts
surface=gts.read(open('parallellepiped.gts')) # the one from examples/jointedCohesiveFrictionalPM

pred=pack.inGtsSurface(surface)
print 'Dim from pred.dim = ',pred.dim()

center,dim,orientation=gtsSurfaceBestFitOBB(surface)
print 'Dim from gtsSurfaceBestFitOBB =',dim
*******************************

I get the correct output with a not up to date YADE version as follows:
*******************************
Dim from pred.dim = Vector3(0.9999999404,2.0000000002092895,1)
Dim from gtsSurfaceBestFitOBB = Vector3(0.4999999702,1.0000000001046447,0.5) # two are "equal" with a normal factor 2
*******************************

Whereas an up to date YADE version returns:
*******************************
Dim from pred.dim = Vector3(0.9999999404,2.0000000002092895,1)
Dim from gtsSurfaceBestFitOBB = Vector3(6.91989746778284e-310,3.47644378095352e-310,5e-324)
*******************************

These two versions differ for instance in the related function bestFitOBB() in py/pack/_packObb.cpp, in relation with this commit: (the difference is exactly the one introduced by this commit) https://github.com/yade/trunk/commit/4f66360db75afb82029bbe37ae4a4dac36899a33

The bug affects for instance the use of randomDensePack() function with GTS predicates: https://answers.launchpad.net/yade/+question/297125

Any ideas ? (Anton, we need you once again ?)

Jerome

Original bug report by Jérôme Duriez on 2016-07-18 : https://bugs.launchpad.net/yade/+bug/1604125

Edited by Janek Kozicki