protected override void Optimize(SDF obj) { useRefinement = obj.Precise(); useLazyCube = obj.Precise(); if (obj.RequiredGridSize() != 0) { int result = 1; if (useRefinement) { while (result < (obj.RequiredGridSize() + 1)) // Naive Surface Nets require a larger grid in order to be rendered sides correct. { result *= 2; } } else { result = obj.RequiredGridSize() % 2 == 0 ? obj.RequiredGridSize() + 2 : obj.RequiredGridSize() + 1; } _gridX = _gridY = _gridZ = result; } }
/// <summary> /// Checks whether it is possible to use grid refinement and lazy cube evalutions. /// Will resize the triangulation grid if possible. /// </summary> protected virtual void Optimize(SDF obj) { useRefinement = obj.Precise(); useLazyCube = obj.Precise(); if (obj.RequiredGridSize() != 0) { int result = 1; if (useRefinement) { while (result < (obj.RequiredGridSize())) { result *= 2; // results will differ from non-refinement version if the grid can not be divided by 2. } } else { result = obj.RequiredGridSize() % 2 == 0 ? obj.RequiredGridSize() : obj.RequiredGridSize() + 1; } _gridX = _gridY = _gridZ = result; } }