[vtkusers] Calculate geodesic distance

briend at cyceron.fr briend at cyceron.fr
Wed Oct 4 10:43:48 EDT 2017


Hello all,
I woulkd like to calculate, in python, the geodesic distance between two
points on a surface(polydata) with vtkDijkstraGraphGeodesicPath.

But I fail to understand how to do that.

Any help is much appreciated.

Thanks,

My code:

import vtk
cylinder= vtk.vtkSphereSource()
cylinder.SetCenter(0.0, 0.0, 0.0)
cylinder.SetRadius(0.5)

dijkstra = vtk.vtkDijkstraGraphGeodesicPath()
dijkstra.SetInputConnection(cylinder.GetOutputPort())
dijkstra.SetStartVertex(2)
dijkstra.SetEndVertex(10)
dijkstra.Update()

pathMapper = vtk.vtkPolyDataMapper()
pathMapper.SetInputConnection(dijkstra.GetOutputPort())

cylinderMapper = vtk.vtkPolyDataMapper()
cylinderMapper.SetInputConnection(cylinder.GetOutputPort())

pathActor = vtk.vtkActor()
pathActor.SetMapper(pathMapper);
pathActor.GetProperty().SetColor(1,0,0)# Red
pathActor.GetProperty().SetLineWidth(4);

cylinderActor = vtk.vtkActor()
cylinderActor.SetMapper(cylinderMapper)
cylinderActor.GetProperty().SetColor(0,0,1) # (0,0,1) or tomato
cylinderActor.RotateX(30.0)
cylinderActor.RotateY(-45.0)

#distance? 



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


More information about the vtkusers mailing list