[vtkusers] Fill contour

Jothybasu Selvaraj jothybasu at gmail.com
Tue Mar 15 21:40:53 EDT 2016


Hi David

If I set the representation to surface only the outline is shown. I even
tried it with a vtkPolyDataMapper and the results are same.

Here is the rough pipeline

vtkSmartPointer<vtkPolyData>contour=

            vtkSmartPointer<vtkPolyData>::New();

    contour=this->ContourWidget->GetContourRepresentation()->GetContourRepresentationAsPolyData();



    vtkSmartPointer<vtkContourTriangulator>tc=

            vtkSmartPointer<vtkContourTriangulator>::New();

    tc->SetInputData(contour);

    tc->Update();




    vtkSmartPointer<vtkDataSetMapper> polyMapper =

            vtkSmartPointer<vtkDataSetMapper>::New();

    polyMapper->SetInputData(tc->GetOutput());

    polyMapper->ScalarVisibilityOn();

    polyMapper->Update();



     this->polyActor =

            vtkSmartPointer<vtkActor>::New();

    polyActor->SetMapper(polyMapper);

    polyActor->GetProperty()->SetColor(0,1,0);

    polyActor->GetProperty()->SetRepresentationToWireframe();


    this->ViewRenderer->AddActor(this->polyActor);

    this->ViewRenderer->GetRenderWindow()->Render();

    this->ViewRenderer->ResetCamera();


Thanks


Jothy


On Wed, Mar 16, 2016 at 12:24 PM, David Gobbi <david.gobbi at gmail.com> wrote:

> Hi Jothy,
>
> The vtkContourTriangulator always produces a filled contour, so there must
> be something wrong with the way it is being rendered.  Are you sure that
> you aren't calling SetRepresentationToWireframe() on the actor's property?
>
>  - David
>
>
> On Tue, Mar 15, 2016 at 5:45 PM, Jothybasu Selvaraj <jothybasu at gmail.com>
> wrote:
>
>> Hi All
>>
>> I am trying to fill a 2D contour generated by vtkContourWidget. I pass
>> the polydata from the contour widget to vtkContourTriangulator and the
>> output is as shown in the attached image. But, I want a filled contour. How
>> do I do that?
>>
>>
>> Thanks
>>
>> Jothy
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20160316/32618bdc/attachment.html>


More information about the vtkusers mailing list