[vtkusers] Distance filter

Koteswara Rao Ruvva ruvva at yahoo.com
Tue May 30 18:45:48 EDT 2017

Great. That worked. Thank you.Here is updated code snippet.

def ComputeDistanceFilterActors(sourceActor, targetActor):        #Update the sourceActor    sourceTransform = vtk.vtkTransform()    sourceTransform.SetMatrix(sourceActor.GetMatrix())         sourceTransformFilter = vtk.vtkTransformPolyDataFilter()    sourceTransformFilter.SetInputData(sourceActor.GetMapper().GetInput())    sourceTransformFilter.SetTransform(sourceTransform)    sourceTransformFilter.Update()
    #Update the targetActor    targetTransform = vtk.vtkTransform()    targetTransform.SetMatrix(targetActor.GetMatrix())         targetTransformFilter = vtk.vtkTransformPolyDataFilter()    targetTransformFilter.SetInputData(targetActor.GetMapper().GetInput())    targetTransformFilter.SetTransform(targetTransform)    targetTransformFilter.Update()
    clean1 = vtk.vtkCleanPolyData()    clean1.SetInputData(sourceTransformFilter.GetOutput())    clean2 = vtk.vtkCleanPolyData()    clean2.SetInputData(targetTransformFilter.GetOutput())
    distanceFilter.SetInputConnection(0, clean1.GetOutputPort())    distanceFilter.SetInputConnection(1, clean2.GetOutputPort())    distanceFilter.Update()

      From: Cory Quammen <cory.quammen at kitware.com>
 To: Koteswara Rao Ruvva <ruvva at yahoo.com> 
Cc: Foufara via Vtkusers <vtkusers at vtk.org>
 Sent: Tuesday, May 30, 2017 8:32 AM
 Subject: Re: [vtkusers] Distance filter
Hi Rao,

The actor transforms apply only during rendering of the data object -
they do not transform the data objects themselves. To properly account
for the actor transforms in the vtkDistancePolyDataFilter, you would
need to create vtkTransformPolyDataFilters for each actor, copying the
actor transform to the vtkTransform used by
vtkTransformPolyDataFilter, then connect the output port of the
vtkTransformPolyDataFilters to your vtkCleanPolyData filters.


On Mon, May 22, 2017 at 3:24 PM, Koteswara Rao Ruvva via vtkusers
<vtkusers at vtk.org> wrote:
> I have the following code to compute the distance between two polygonal
> actors.
> def ComputeDistanceFilter(sourceActor, targetActor):
>    clean1 = vtk.vtkCleanPolyData()
>    clean1.SetInputData(sourceActor.GetMapper().GetInput())
>    clean2 = vtk.vtkCleanPolyData()
>    clean2.SetInputData(targetActor.GetMapper().GetInput())
>    distanceFilter = vtk.vtkDistancePolyDataFilter()
>    distanceFilter.SetInputConnection(0, clean1.GetOutputPort())
>    distanceFilter.SetInputConnection(1, clean2.GetOutputPort())
>    distanceFilter.Update()
> I am not sure where and how the transformation of the actors should be used
> while computing the distance filter.
> Thank you
> Rao
> _______________________________________________
> 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
> Search the list archives at: http://markmail.org/search/?q=vtkusers
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers

Cory Quammen
Staff R&D Engineer
Kitware, Inc.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20170530/88c21bcd/attachment.html>

More information about the vtkusers mailing list