<html><head></head><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:16px"><div id="yui_3_16_0_ym19_1_1496183996186_4023"><span>Great. That worked. Thank you.</span></div><div id="yui_3_16_0_ym19_1_1496183996186_4024"><span id="yui_3_16_0_ym19_1_1496183996186_4737">Here is updated code snippet.</span></div><div id="yui_3_16_0_ym19_1_1496183996186_4025"><span><br></span></div><div class="qtdSeparateBR" id="yui_3_16_0_ym19_1_1496183996186_3883"><br><div id="yui_3_16_0_ym19_1_1496183996186_4608">def ComputeDistanceFilterActors(sourceActor, targetActor):</div><div id="yui_3_16_0_ym19_1_1496183996186_4609">    </div><div id="yui_3_16_0_ym19_1_1496183996186_4614">    #Update the sourceActor</div><div id="yui_3_16_0_ym19_1_1496183996186_4615">    sourceTransform = vtk.vtkTransform()</div><div id="yui_3_16_0_ym19_1_1496183996186_4616">    sourceTransform.SetMatrix(sourceActor.GetMatrix())</div><div id="yui_3_16_0_ym19_1_1496183996186_4617">     </div><div id="yui_3_16_0_ym19_1_1496183996186_4618">    sourceTransformFilter = vtk.vtkTransformPolyDataFilter()</div><div id="yui_3_16_0_ym19_1_1496183996186_4619">    sourceTransformFilter.SetInputData(sourceActor.GetMapper().GetInput())</div><div id="yui_3_16_0_ym19_1_1496183996186_4620">    sourceTransformFilter.SetTransform(sourceTransform)</div><div id="yui_3_16_0_ym19_1_1496183996186_4621">    sourceTransformFilter.Update()</div><div id="yui_3_16_0_ym19_1_1496183996186_4622"><br id="yui_3_16_0_ym19_1_1496183996186_4623"></div><div id="yui_3_16_0_ym19_1_1496183996186_4624">    #Update the targetActor</div><div id="yui_3_16_0_ym19_1_1496183996186_4625">    targetTransform = vtk.vtkTransform()</div><div id="yui_3_16_0_ym19_1_1496183996186_4626">    targetTransform.SetMatrix(targetActor.GetMatrix())</div><div id="yui_3_16_0_ym19_1_1496183996186_4627">     </div><div id="yui_3_16_0_ym19_1_1496183996186_4628">    targetTransformFilter = vtk.vtkTransformPolyDataFilter()</div><div id="yui_3_16_0_ym19_1_1496183996186_4629">    targetTransformFilter.SetInputData(targetActor.GetMapper().GetInput())</div><div id="yui_3_16_0_ym19_1_1496183996186_4630">    targetTransformFilter.SetTransform(targetTransform)</div><div id="yui_3_16_0_ym19_1_1496183996186_4631">    targetTransformFilter.Update()</div><div id="yui_3_16_0_ym19_1_1496183996186_4632"><br id="yui_3_16_0_ym19_1_1496183996186_4633"></div><div id="yui_3_16_0_ym19_1_1496183996186_4634">    clean1 = vtk.vtkCleanPolyData()</div><div id="yui_3_16_0_ym19_1_1496183996186_4635">    clean1.SetInputData(sourceTransformFilter.GetOutput())</div><div id="yui_3_16_0_ym19_1_1496183996186_4636">    clean2 = vtk.vtkCleanPolyData()</div><div id="yui_3_16_0_ym19_1_1496183996186_4637">    clean2.SetInputData(targetTransformFilter.GetOutput())</div><div id="yui_3_16_0_ym19_1_1496183996186_4638"><br id="yui_3_16_0_ym19_1_1496183996186_4639"></div><div id="yui_3_16_0_ym19_1_1496183996186_4640" dir="ltr">    distanceFilter.SetInputConnection(0, clean1.GetOutputPort())</div><div id="yui_3_16_0_ym19_1_1496183996186_4641" dir="ltr">    distanceFilter.SetInputConnection(1, clean2.GetOutputPort())</div><div id="yui_3_16_0_ym19_1_1496183996186_4642">    distanceFilter.Update()</div><div id="yui_3_16_0_ym19_1_1496183996186_4643"><br></div><div dir="ltr" id="yui_3_16_0_ym19_1_1496183996186_4647"><br id="yui_3_16_0_ym19_1_1496183996186_4648"></div></div><div class="yahoo_quoted" id="yui_3_16_0_ym19_1_1496183996186_3923" style="display: block;">  <div style="font-family: times new roman, new york, times, serif; font-size: 16px;" id="yui_3_16_0_ym19_1_1496183996186_3922"> <div style="font-family: HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif; font-size: 16px;" id="yui_3_16_0_ym19_1_1496183996186_3921"> <div dir="ltr" id="yui_3_16_0_ym19_1_1496183996186_3920"> <font size="2" face="Arial" id="yui_3_16_0_ym19_1_1496183996186_3919"> <hr size="1" id="yui_3_16_0_ym19_1_1496183996186_3918"> <b><span style="font-weight:bold;">From:</span></b> Cory Quammen <cory.quammen@kitware.com><br> <b><span style="font-weight: bold;">To:</span></b> Koteswara Rao Ruvva <ruvva@yahoo.com> <br><b><span style="font-weight: bold;">Cc:</span></b> Foufara via Vtkusers <vtkusers@vtk.org><br> <b><span style="font-weight: bold;">Sent:</span></b> Tuesday, May 30, 2017 8:32 AM<br> <b><span style="font-weight: bold;">Subject:</span></b> Re: [vtkusers] Distance filter<br> </font> </div> <div class="y_msg_container" id="yui_3_16_0_ym19_1_1496183996186_3924"><br><div dir="ltr" id="yui_3_16_0_ym19_1_1496183996186_3925">Hi Rao,<br clear="none"><br clear="none">The actor transforms apply only during rendering of the data object -<br clear="none">they do not transform the data objects themselves. To properly account<br clear="none">for the actor transforms in the vtkDistancePolyDataFilter, you would<br clear="none">need to create vtkTransformPolyDataFilters for each actor, copying the<br clear="none">actor transform to the vtkTransform used by<br clear="none">vtkTransformPolyDataFilter, then connect the output port of the<br clear="none">vtkTransformPolyDataFilters to your vtkCleanPolyData filters.<br clear="none"><br clear="none">HTH,<br clear="none">Cory<br clear="none"><div class="yqt9862134510" id="yqtfd18271"><br clear="none">On Mon, May 22, 2017 at 3:24 PM, Koteswara Rao Ruvva via vtkusers<br clear="none"><<a shape="rect" ymailto="mailto:vtkusers@vtk.org" href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>> wrote:<br clear="none">> I have the following code to compute the distance between two polygonal<br clear="none">> actors.<br clear="none">><br clear="none">> def ComputeDistanceFilter(sourceActor, targetActor):<br clear="none">><br clear="none">>     clean1 = vtk.vtkCleanPolyData()<br clear="none">>     clean1.SetInputData(sourceActor.GetMapper().GetInput())<br clear="none">>     clean2 = vtk.vtkCleanPolyData()<br clear="none">>     clean2.SetInputData(targetActor.GetMapper().GetInput())<br clear="none">><br clear="none">>     distanceFilter = vtk.vtkDistancePolyDataFilter()<br clear="none">>     distanceFilter.SetInputConnection(0, clean1.GetOutputPort())<br clear="none">>     distanceFilter.SetInputConnection(1, clean2.GetOutputPort())<br clear="none">>     distanceFilter.Update()<br clear="none">><br clear="none">> I am not sure where and how the transformation of the actors should be used<br clear="none">> while computing the distance filter.<br clear="none">><br clear="none">> Thank you<br clear="none">> Rao<br clear="none">><br clear="none">> _______________________________________________<br clear="none">> Powered by www.kitware.com<br clear="none">><br clear="none">> Visit other Kitware open-source projects at<br clear="none">> <a shape="rect" href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br clear="none">><br clear="none">> Please keep messages on-topic and check the VTK FAQ at:<br clear="none">> <a shape="rect" href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br clear="none">><br clear="none">> Search the list archives at: <a shape="rect" href="http://markmail.org/search/?q=vtkusers" target="_blank">http://markmail.org/search/?q=vtkusers</a><br clear="none">><br clear="none">> Follow this link to subscribe/unsubscribe:<br clear="none">> <a shape="rect" href="http://public.kitware.com/mailman/listinfo/vtkusers" target="_blank">http://public.kitware.com/mailman/listinfo/vtkusers</a></div><br clear="none">><br clear="none"><br clear="none"><br clear="none"><br clear="none">-- <br clear="none">Cory Quammen<br clear="none">Staff R&D Engineer<br clear="none">Kitware, Inc.<div class="yqt9862134510" id="yqtfd63619"><br clear="none"></div></div><br><br></div> </div> </div>  </div></div></body></html>