[vtkusers] deriving from vtkPolygonalSurfacePointPlacer

Miro Drahos mdrahos at robodoc.com
Mon Jun 30 21:43:12 EDT 2014


Hi all,
I am trying to customize the behavior of vtkContourWidget to constrain 
drawing contours on a surface, and I need to modify the point placer to 
reimplement the validation. In particular, the default contouring (in 
5.10) doesn't support surfaces with multiple components (with 
vtkPolygonalSurfaceContourLineInterpolator and 
vtkOrientedGlyphContourRepresentation).
I thought I would separate the surface into connected regions and then 
validate against the region id to make sure I don't lock up the 
interpolator in trying to find the path between the components (which 
obviously doesn't exist).
I thought I would just write my point placer and reimplement the 
validating methods:

//====================================
class myPointPlacer : public vtkPolygonalSurfacePointPlacer
{
public :
     //...
     virtual int ValidateWorldPosition(double wPt[3]);
     virtual int ValidateDisplayPosition(vtkRenerer *, double dispPt[2]);
     //....
};
//--------------------------------------------------
int myPointPlacer::ValidateWorldPosition(double wPt[3])
{
      vtkIdType curRegionId;
      // extract the curRegionId here
      // ...
      if (this->Internals->Nodes.empty())  // compiler will complain 
here: "Invalid use of incomplete type"
       {
          this->regionId = curRegionId;
       }
      else
       {
          if (curRegionId != this->regionId)  // point on a different 
region, reject
             return 0;
       }

   return 1;
}
//====================================

Alas, this won't compile because the 
vtkPolygonalSurfacePointPlacerInternals is defined in 
vtkPolygonalSurfacePointPlacer.cxx, and there is no header file I could 
#include that would tell the compiler what this->Internals is...

How can I get around this and use the internals?
Thank you for all ideas/suggestions!
Using VTK 5.10.

Cheers,
Miro

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140630/2564aad9/attachment.html>


More information about the vtkusers mailing list