[vtkusers] vtkPolygonalSurfacePointPlacer takes 7 seconds to place a point.

alican alican1812 at hotmail.com
Wed Jan 24 05:11:54 EST 2018


This piece of code takes 7 seconds for one point on 40,000 points' polydata.
Is it an expected performance?
Is there something I can do to improve it?
Unfortunately, I cannot decimate, the data should be preserved as is. 
Thank you,
AC

			vtkSmartPointer<vtkPolyDataMapper> mapper =			
vtkSmartPointer<vtkPolyDataMapper>::New();
			mapper->SetInputData(input);// of vtkPolyData type

			vtkSmartPointer<vtkActor> actor =				vtkSmartPointer<vtkActor>::New();
			actor->SetMapper(mapper);

			vtkSmartPointer<vtkRenderer> renderer =
vtkSmartPointer<vtkRenderer>::New();
			vtkSmartPointer<vtkRenderWindow> renderWindow =
vtkSmartPointer<vtkRenderWindow>::New();
			renderWindow->AddRenderer(renderer);
			vtkSmartPointer<vtkRenderWindowInteractor> interactor =
vtkSmartPointer<vtkRenderWindowInteractor>::New();
			interactor->SetRenderWindow(renderWindow);

			renderer->AddActor(actor);

			vtkSmartPointer<vtkContourWidget> contourWidget =
vtkSmartPointer<vtkContourWidget>::New();
			contourWidget->SetInteractor(interactor);

			vtkOrientedGlyphContourRepresentation* rep =
vtkOrientedGlyphContourRepresentation::SafeDownCast(contourWidget->GetRepresentation());

			vtkPolygonalSurfaceContourLineInterpolator * lip =
vtkPolygonalSurfaceContourLineInterpolator::New();
			lip->GetPolys()->AddItem(input);
		rep->SetLineInterpolator(lip);
			vtkSmartPointer<vtkPolygonalSurfacePointPlacer> pointPlacer =
vtkSmartPointer<vtkPolygonalSurfacePointPlacer>::New();
			pointPlacer->AddProp(actor);
			pointPlacer->GetPolys()->AddItem(input);
			//pointPlacer->SnapToClosestPointOn();

			rep->GetLinesProperty()->SetColor(1, 0, 0);
			rep->GetLinesProperty()->SetLineWidth(3.0);
			rep->SetPointPlacer(pointPlacer);

			contourWidget->EnabledOn();
			renderer->ResetCamera();
			renderWindow->Render();
			interactor->Initialize();

			interactor->Start();





--
Sent from: http://vtk.1045678.n5.nabble.com/VTK-Users-f1224199.html


More information about the vtkusers mailing list