# [vtkusers] Poor results with vtkSurfaceReconstructionFilter

Tim Hutton T.Hutton at eastman.ucl.ac.uk
Wed Sep 4 06:50:10 EDT 2002

```Hi Carl,

The filter has known problems, compare your results with:

http://cgi.ncsa.uiuc.edu/People/heiland/vtk/scatter/sphere/

The reason for the strange results are to do with the surface
reconstruction algorithm, which is rather old.

The good news is that there is now a solution! Try the powercrust filter:

http://www.eastman.ucl.ac.uk/~thutton/powercrust/

Let me know how you get on.

Tim.

At 11:40 04/09/2002 +0100, Carl Hetherington wrote:
>Hi,
>
>I'm trying to reconstruct a surface from a set of unorganized points, and
>to test it out I've written the following code.  It builds a sphere out of
>points and then tries to reconstruct its surface.
>
>   const float radius = 1.0;
>   const int angle_steps = 500;
>
>   vtkUnstructuredGrid* vtk_grid = vtkUnstructuredGrid::New();
>   vtkPoints* vtk_points = vtkPoints::New();
>
>   int pc = 0;
>   float step = 2 * pi / angle_steps;
>   for (float theta = 0; theta < 4 * pi; theta += step)
>     for (float phi = 0; phi < 2 * pi; phi += step)
>     {
>       float xyz[3];
>       xyz[0] = radius * cos(theta) * sin(phi);
>       xyz[1] = radius * sin(theta) * sin(phi);
>       xyz[2] = radius * cos(phi);
>       vtk_points->InsertNextPoint(xyz);
>       vtk_grid->InsertNextCell(VTK_VERTEX, 1, &pc);
>       pc++;
>     }
>
>   vtk_grid->SetPoints(vtk_points);
>
>   vtkSurfaceReconstructionFilter* recon =
> vtkSurfaceReconstructionFilter::New();
>   recon->SetInput(vtk_grid);
>   recon->Update();
>
>   vtkContourFilter* contour = vtkContourFilter::New();
>   contour->SetInput(recon->GetOutput());
>   contour->SetNumberOfContours(1);
>   contour->SetValue(0, 0.0);
>   contour->UseScalarTreeOn();
>   contour->Update();
>
>The resulting surface is ok in most areas but has some fairly wild errors.
>An example of the dodgy output is available at
>http://www-users.york.ac.uk/~cth103/surf.vtk
>
>Can anyone suggest why this might be happening?
>
>Thanks in advance for any help
>Carl
>
>
>
>
>_______________________________________________
>This is the private VTK discussion list.
>Please keep messages on-topic. Check the FAQ at:
><http://public.kitware.com/cgi-bin/vtkfaq>
>http://public.kitware.com/mailman/listinfo/vtkusers

---------------------------------------------------------------------------
Tim Hutton,                        http://www.eastman.ucl.ac.uk/~dmi/MINORI
Research Fellow & PhD student,                   T.Hutton at eastman.ucl.ac.uk
MINORI Project, Biomedical Informatics Unit,     Tel: [+44] (0)20 7915 2344
Eastman Dental Institute, UCL,                   Fax: [+44] (0)20 7915 2303
256 Gray's Inn Road, London WC1X 8LD, UK      Mobile: [+44] (0)7748 678 832
---------------------------------------------------------------------------
This email represents the views of the sender alone and must not be
construed as representing the views of the Eastman Dental Institute. It may
contain confidential information and may be protected by law as a legally
privileged document and copyright work. Its content should not be disclosed
and it should not be given or copied to anyone other than the person(s)
named or referenced above. If you have received this email in error, please
contact the sender.

```