[vtkusers] Problems in applying an adaptive subdivision algorithm using vtk

David.Pont at ForestResearch.co.nz David.Pont at ForestResearch.co.nz
Tue Oct 28 19:42:52 EST 2003


Dimitris,
   I don't know if you will like me or hate me!, but I have just recently
completed a vtk class to do adaptive polygonization of implicit surfaces.
It might need a few changes to the implementation for clarity / efficiency,
but it is working nicely. I was planning to submit it to vtk soon, what I
need is willing testers to kick it around and see if it can break.
The algorithm is that by Luiz Velho: Simple and efficient polygonization of
implicit surfaces. Journal of Graphics Tools, 1(2):5-24, 1996.
If you want I will send you a pdf of the Velho paper and the code?

Of course there is no need for you to stop what you are doing, if you want
to develop your own algorithm  (viva la difference!) the following may
help:

To calculate polygon (cell) normals on-the-fly you could use something like
the following fragment:

      if( ! this->poly ) this->poly = vtkPolygon::New();
      ...
      vtkPoints *pts = cell->GetPoints();
      poly->ComputeNormal( pts, cNormal );

ie construct a 'local' copy of a cell, use the current cell points to get a
normal from vtkPolygon->ComputeNormal. Not sure how efficient this is.

To get point normals you could average adjacent cell normals. The following
gives the cells using a given point:
      this->input->GetPointCells( pid, cells );
Then use ComputeNormal on each cell...

This way you do not need vtkPolyDataNormals upstream, which is of limited
use because you are changing geometry anyway.

The Velho algorithm relies heavily on 'normals'. Actually it uses the
implicit function gradient so there is no need to use normals (very
clever), just lots of calls to EvaluateGradient.


To generate an output data set with more polygons than the input data set
you are probably best to start with a new empty data set and add new
triangles once they are fully 'adapted', this way you can simply use
InsertNextCell. This may require thinking about algorithm structure. If the
algorithm demands that you generate a set of polygons at one pass, then
repeat to adapt further, you might have to use your own internal
representation to hold intermediate polygons, or use an internal
vtkPolyData buffer (or two), before writing the final output.

Hope that helps
    Dave P



|---------+---------------------------->
|         |           "Dimitris        |
|         |           Andritsos"       |
|         |           <jimandr at hotmail.|
|         |           com>             |
|         |           Sent by:         |
|         |           vtkusers-admin at vt|
|         |           k.org            |
|         |                            |
|         |                            |
|         |           29/10/2003 11:43 |
|         |                            |
|---------+---------------------------->
  >--------------------------------------------------------------------------------------------------------------------------------|
  |                                                                                                                                |
  |       To:       vtkusers at public.kitware.com                                                                                    |
  |       cc:                                                                                                                      |
  |       Subject:  [vtkusers] Problems in applying an adaptive subdivision algorithm using vtk                                    |
  >--------------------------------------------------------------------------------------------------------------------------------|




Hello All,

I am trying to implement an algorithm that performs adjustment and adaptive

subdivision of a polygonal mesh approximation of an implicit surface. I am
using Marching Cubes to obtain a coarse approximation of the mesh and
afterwards I am working with that.

The algorithm depends very much on the normals at the vertices and centers
of the triangular mesh. So before beginning with the algorithm I use
vtkPolyDataNormals to obtain the normals at the vertices and the triangle
centers of the mesh that results from Marching Cubes. Then I use the output

from vtkPolyDataNormals as input to the algorithm. Up to this point there
is
no problem .After performing some iterations with the algorithm, the
topology of the mesh changes and so should the normals. However I haven't
managed to succeed in changing these. Although, I am calling Update for the

mesh after each iteration of the algorithm the normals remain the same. But

if each time I create a new instance of vtkPolyDataNormals and use that to
compute the normals then these appear to be different from iteration to
iteration. I would really appreaciate any help on how this should be
correctly done.

The second problem has to do with insertion of new triangles. I would like
your help on what would be the best way to update the PolyData mesh each
time a triangle is split. I am working with InsertNextLinkedCell and Point
but I am getting strange debug errors.

Thank you very much in advance,
Dimitris

_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at: <
http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://www.vtk.org/mailman/listinfo/vtkusers








More information about the vtkusers mailing list