# vtkimplicitModeller very slow or making holes

Hi,

I am trying to create a distance map and get
the contour close to the surface (a few mm
from the zero level of the contour).

So I got the bounds of the polydata I modified it with the bounds considering the
thickness so that it fits in the output bounds
and i calculated the dimensions. Doing
this i get the thickness i want even
the small one but it is very very slow.

SetSampleDimensions(dim)

And if i define a bigger spacing i cannot get the
thin surface (e.g., 0.10 from the surface)

So i wonder how i can speed up the process
to get a small thickness from the surface.

``````implicitModeller->SetModelBounds(bounds);
double spacing[3] = { 0.10,0.10,0.10 };
// compute dimensions
int dim[3];
for (int i = 0; i < 3; i++)
{
dim[i] = static_cast<int>(ceil((bounds
[i * 2 + 1] - bounds[i * 2]) / spacing[i]));
}
implicitModeller->SetSampleDimensions(dim);
``````

In case i was doing level selts it would be
impossible to get the zero level.

Any help with this filter?. Distance map is usally
used for its speed so i am bit surprised
of the slow speed of this filter.

Thank you very much
Cheers

You should set maximum distance to prevent computing distances across the whole volume. You may also need to have lots of physical RAM if your very fine resolution bitmap gets very big.

Once you have constructed the distance map, it is very fast - but of course you need to compute the values first and it takes time.

Also, for shell generation from surface, the main advantage of using a distance map is not the potential speed improvement but its robustness. Mesh-based methods often struggle with self-intersection, while this is not an issue with distance maps.

Hi, thank you for answering. Sure, i am using the distance map to avoid the intersection of the faces and i avoid holes with this. Perfect, i will do that tocompute it at the beginning maybe in background to speed up. I just wanted to be sure i was using it well or if i could optimize it.

I found this vtkSignedDistance filter, it seems quite interesting. When i update the vtk, it will try it.

Thank you very much for all the help

Implicit modeller can only be used for creating symmetric surface (the original surface is not preserved), but works for open surfaces, while signed distance filter allows you to create shell from closed surface, while keeping the closed surface as inner or surface.