[vtkusers] question about vtkQuadric, SamleFunction and ContourFilter

Frederic Simons Simons at inbk.rwth-aachen.de
Tue Nov 20 06:07:00 EST 2012


Hello everyone,

I've got a problem trying to create a Polygon using a vtkImlicitFunction (vtkQuadric) , a sampler and the vtkContourfilter. The Code  is:

> vtkSmartPointer<vtkQuadric>  quadric =
>                             vtkSmartPointer<vtkQuadric> ::New();
>
> // elliptical cylinder
> quadric-> SetCoefficients(0, 0.5, 0.1,
>                                             0, 0, 0,
>                                             0, 0, 0,
>                                             -1.0);
>
> // sample parameters from the examples (they work!)
> /*quadric-> SetCoefficients(1, 1, 0.2,
>                                             0, 0.1, 0,
>                                             0, 0.2, 0,
>                                             0.0);*/
>
> // Sample the quadric function
> vtkSmartPointer<vtkSampleFunction>  sample =
>             vtkSmartPointer<vtkSampleFunction> ::New();
>
> sample-> SetSampleDimensions(50,50,50);
> sample-> SetImplicitFunction(quadric);
> sample-> SetModelBounds(0, 1, 0, 1, 0, 1);
> sample-> Update();
>
> vtkSmartPointer<vtkContourFilter>  c1 =
>             vtkSmartPointer<vtkContourFilter> ::New();
>
> c1-> SetInputConnection(sample-> GetOutputPort());
> c1-> GenerateValues(1, 1.0, 1.0);
> c1-> Update();
>
> vtkSmartPointer<vtkXMLPolyDataWriter>  writer =
>             vtkSmartPointer<vtkXMLPolyDataWriter> ::New();
> std::string f_name = "QUADRIC_1.vtp";
> writer-> SetFileName(f_name.c_str());
> writer-> SetInputConnection(c1-> GetOutputPort());
> writer-> Write();

With the parameters in the examples (http://www.vtk.org/Wiki/VTK/Examples/Cxx/Visualization/QuadraticSurface) it just works. Using my own parameters (here for testing purposes --- body should be an elliptical cylinder) it fails. Also the Output of the sampler is empty (printed the vtkImageData to a .vti file ) ..

Later on this code must work with any given parameters (any reasonable, the resulting surface will be used in conjunction with vtkBooleanOperationPolyData-thingie to construct complex object).

My Question:
Are there *ANY* constrains with the vtkQuadric/vtkSampleFunction/vtkContourFilter that I'm not aware of. In the doc I haven't  found anything regarding degenerate quadratic surfaces.
Please enlighten me.

Kind regards & thanks in advance
Frederic Simons
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20121120/8927c425/attachment.htm>


More information about the vtkusers mailing list