[vtkusers] Can you help with this please?

Bill Lorensen bill.lorensen at gmail.com
Wed Jan 28 08:09:00 EST 2015


The resulting triangle do not have normals so changing the shading
interpolation won't help. What is the source and precision of the
original points?


On Wed, Jan 28, 2015 at 7:59 AM,  <soleimani1639 at gmail.com> wrote:
> Hi Bill,
>
> I am trying to make a model of human chest. I have some points of the chest that I send you the link (first link). I have used vtkDelaunay2D to put a surface on the points but the surface is not smooth. I used "SetInterpolationToPhong" property as well, but it did not worked for me. It seems that the results form Phong has no difference from Flat !!!!
> Also I have used "vtkSurfaceReconstructionFilter", but it modify the points position very much and I don't want this much of modification.
> I have copied my code at the end of the email.
>
> I appreciate if you can help me with this (to have a smooth surface).
>
> Cheers,
> Vahid
>
> points of the chest:
> https://drive.google.com/open?id=0BxUVE0cBp62XazgwWWJsMFFpa28&authuser=0
>
> vtkDelaunay2D model:
> https://drive.google.com/open?id=0BxUVE0cBp62Xc3pyeFQ0Zmh5MGM&authuser=0
>
>
>   int main(int, char *[])
> {
>
>   vtkSmartPointer<vtkPoints> points =
>     vtkSmartPointer<vtkPoints>::New();
>
>   int  widthOffset = 241 , heightOffset = 178;
>
>   readPoints(points, "extra_files/depth_chest19.png", heightOffset, widthOffset);
>
>   vtkSmartPointer<vtkPolyData> polydata =
>     vtkSmartPointer<vtkPolyData>::New();
>   polydata->SetPoints(points);
>
>   // Triangulate the grid points
>   vtkSmartPointer<vtkDelaunay2D> delaunay =
>    vtkSmartPointer<vtkDelaunay2D>::New();
>   delaunay->SetInputData(polydata);
>   delaunay->Update();
>
>   // Visualize
>   vtkSmartPointer<vtkPolyDataMapper> meshMapper =
>     vtkSmartPointer<vtkPolyDataMapper>::New();
>   meshMapper->SetInputConnection(delaunay->GetOutputPort());
>
>   vtkSmartPointer<vtkActor> meshActor =
>     vtkSmartPointer<vtkActor>::New();
>   meshActor->SetMapper(meshMapper);
>   //meshActor->GetProperty()->SetEdgeColor(0,0,1); // Why aren't the edges aren't visible unless we set the representation to wireframe?
>   //meshActor->GetProperty()->EdgeVisibilityOn();
>   //meshActor->GetProperty()->SetDiffuseColor(0.0, 0.4, 0.8);
>   //meshActor->GetProperty()->SetInterpolationToFlat();
>   //meshActor->GetProperty()->SetRepresentationToWireframe();
>   //meshActor->GetProperty()->SetInterpolationToGouraud();
>   meshActor->GetProperty()->SetInterpolationToPhong();
>
>   // Create a renderer, render window, and interactor
>   vtkSmartPointer<vtkRenderer> renderer =
>     vtkSmartPointer<vtkRenderer>::New();
>   vtkSmartPointer<vtkRenderWindow> renderWindow =
>     vtkSmartPointer<vtkRenderWindow>::New();
>   renderWindow->AddRenderer(renderer);
>   renderWindow->SetSize(600,600);
>   renderWindow->SetPosition(600,200);
>
>
>   vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
>     vtkSmartPointer<vtkRenderWindowInteractor>::New();
>   renderWindowInteractor->SetRenderWindow(renderWindow);
>
>   vtkSmartPointer<MyInteractorStyle> mystyle =
>     vtkSmartPointer<MyInteractorStyle>::New();
>   mystyle->SetActor(meshActor);
>
>   renderWindowInteractor->SetInteractorStyle( mystyle );
>
>
>   // Add the actor to the scene
>   renderer->AddActor(meshActor);
>   //renderer->AddActor(boundaryActor);
>   renderer->SetBackground(.0, .1, .0); // Background color green
>
>   // Render and interact
>   renderWindow->Render();
>   renderWindow->SetWindowName("Chest wall: wired-form (denoised with gaussian filter)");
>   renderWindowInteractor->Start();
>
>   return EXIT_SUCCESS;
> }
>
> _____________________________________
> Sent from http://vtk.1045678.n5.nabble.com
>



-- 
Unpaid intern in BillsBasement at noware dot com


More information about the vtkusers mailing list