[vtkusers] View Surface
Dženan Zukić
dzenanz at gmail.com
Fri Feb 4 05:01:52 EST 2011
You cannot really view it as a surface, as a bunch of points, with not
associations between them (which 3 points are edges of which triangle), they
are not a surface. First you need to apply some surface reconstruction
algorithm
Regards,
Dženan
On Fri, Feb 4, 2011 at 08:58, Nelson <gnjoseph at gmail.com> wrote:
>
> Hi All,
>
> This code displays only the nodes. ( I have attached the screen shot ) How
> can we view as a surface?
>
> #include <vtkSmartPointer.h>
> #include <vtkProperty.h>
> #include <vtkPolyDataMapper.h>
> #include <vtkActor.h>
> #include <vtkParticleReader.h>
> #include <vtkRenderWindow.h>
> #include <vtkRenderWindowInteractor.h>
> #include <vtkInteractorStyleTrackballCamera.h>
> #include <vtkRenderer.h>
> int main()
> {
>
> // Read the file
> vtkSmartPointer<vtkParticleReader> reader =
> vtkSmartPointer<vtkParticleReader>::New();
> reader->SetFileName ( "cube.txt" );
> reader->Update();
> std::cout << reader->GetOutput()->GetNumberOfCells() << std::endl;
> // Visualize
> vtkSmartPointer<vtkPolyDataMapper> mapper =
> vtkSmartPointer<vtkPolyDataMapper>::New();
> mapper->SetInputConnection(reader->GetOutputPort());
> vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
> actor->SetMapper(mapper);
> actor->GetProperty()->SetPointSize(4);
> actor->GetProperty()->SetColor(1,0,0);
> vtkSmartPointer<vtkRenderer> renderer =
> vtkSmartPointer<vtkRenderer>::New();
> vtkSmartPointer<vtkRenderWindow> renderWindow =
> vtkSmartPointer<vtkRenderWindow>::New();
> renderWindow->AddRenderer(renderer);
> vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
> vtkSmartPointer<vtkRenderWindowInteractor>::New();
> renderWindowInteractor->SetRenderWindow(renderWindow);
> renderer->AddActor(actor);
> renderer->SetBackground(.3, .6, .3); // Background color green
>
> vtkSmartPointer<vtkInteractorStyleTrackballCamera> style =
> vtkSmartPointer<vtkInteractorStyleTrackballCamera>::New();
> renderWindowInteractor->SetInteractorStyle( style );
>
> renderWindow->Render();
> renderWindowInteractor->Start();
> return EXIT_SUCCESS;
> } http://vtk.1045678.n5.nabble.com/file/n3370577/sample.jpg
>
> -----
> Best Regards,
> Nelson
> --
> View this message in context:
> http://vtk.1045678.n5.nabble.com/View-Surface-tp3370577p3370577.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the VTK FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20110204/88a0ef10/attachment.htm>
More information about the vtkusers
mailing list