Skip to content

outsideOK aka unbound functionality in LevelSet

Jérôme Duriez requested to merge unbound into master

Connected to !961 (merged), either we merge that one first, or you include the same ideas in !961 (merged), Danny @DLHvdH ?

Example (with that new code):

In [1]: b = levelSetBody('sphere',(0,0,0),1)

In [2]: b.shape.lsGrid.max()
Out[2]: Vector3(1.100000000000000089,1.100000000000000089,1.100000000000000089)

In [3]: b.shape.distance(2*Vector3.Ones)
<ERROR> RegularGrid:46 yade::Vector3i yade::RegularGrid::closestCorner(const Vector3r&, const bool&) const: You're asking for the closest grid point to a pt 2 2 2 which is outside the grid.. Returning negative indices, it may crash in few seconds.
<ERROR> LevelSet:416 yade::Real yade::LevelSet::distance(const Vector3r&, const bool&) const: Can not compute the distance, returning NaN
Out[3]: nan

In [4]: b.shape.distance(2*Vector3.Ones,True)
Out[4]: 2.1184139252299166

In [5]: b.shape.normal(2*Vector3.Ones)
<ERROR> RegularGrid:46 yade::Vector3i yade::RegularGrid::closestCorner(const Vector3r&, const bool&) const: You're asking for the closest grid point to a pt 2 2 2 which is outside the grid.. Returning negative indices, it may crash in few seconds.
<ERROR> LevelSet:226 yade::Vector3r yade::LevelSet::normal(const Vector3r&, const bool&) const: Can not compute the normal, returning a NaN vector
Out[5]: Vector3(nan,nan,nan)

In [6]: b.shape.normal(2*Vector3.Ones,True)
Out[6]: Vector3(0.5773502691896258421,0.5773502691896258421,0.577350269189625842

Merge request reports