Make filter_csg more robust against rounding issues.

This commit is contained in:
Paolo Cignoni cignoni 2010-10-01 18:53:39 +00:00
parent 7defdfc2a1
commit d2abab4c5a

View File

@ -660,12 +660,12 @@ namespace vcg {
public:
template <class MeshType>
inline InterceptSet3(const MeshType &m, const Point3x &d, int subCellPrecision=32, vcg::CallBackPos *cb=vcg::DummyCallBackPos) : delta(d),
bbox(Point3i(floor(m.bbox.min.X() / d.X()) -1,
floor(m.bbox.min.Y() / d.Y()) -1,
floor(m.bbox.min.Z() / d.Z()) -1),
Point3i(ceil(m.bbox.max.X() / d.X()),
ceil(m.bbox.max.Y() / d.Y()),
ceil(m.bbox.max.Z() / d.Z())))
bbox(Point3i(floor(m.bbox.min.X() / d.X()) - 1,
floor(m.bbox.min.Y() / d.Y()) - 1,
floor(m.bbox.min.Z() / d.Z()) - 1),
Point3i(ceil(m.bbox.max.X() / d.X()) + 1,
ceil(m.bbox.max.Y() / d.Y()) + 1,
ceil(m.bbox.max.Z() / d.Z()) + 1))
{
const Point3x invDelta(Scalar(1) / delta.X(),
Scalar(1) / delta.Y(),