<div dir="ltr"><div>Hi All,</div>
<div> </div>
<div>I want to get the center fo the vtkbox widget at the beginning of moving it and at the end of moving it</div>
<div> </div>
<div>I tried adding two observers one at interaction event and the second at the Endinteraction event , but unfortunatly the center result from both of thoses are the same </div>
<div> </div>
<div>any suggestion to solve that </div>
<div> </div>
<div> public static void InteractionEvent(vtk.vtkObject obj, uint eventId, Object data, IntPtr clientdata)<br> {<br> vtkBoxWidget widget = vtkBoxWidget.SafeDownCast(obj);<br> widget.GetPlanes(planes);<br>
selectActor.VisibilityOn();</div>
<div> </div>
<div><br> vtkPolyData before = new vtkPolyData();<br> widget.GetPolyData(before);<br> center_Before = GetBoundsCenter(before.GetBounds());</div>
<div><br> //maceActor.VisibilityOff();<br> ///////////// Test writting /////////////////////////////////////////////<br> //Write the file</div>
<div><br> /*vtkXMLPolyDataWriter writer = new vtkXMLPolyDataWriter ();<br> writer.SetInputConnection(clipper.GetOutputPort());<br> writer.SetFileName("disk.vtp");<br> writer.Write();*/</div>
<div> </div>
<div><br> }<br> public static void EndInteractionEvent(vtk.vtkObject obj, uint eventId, Object data, IntPtr clientdata)<br> {<br> vtkBoxWidget widget = vtkBoxWidget.SafeDownCast(obj);<br> vtkPolyData after = new vtkPolyData();<br>
widget.GetPolyData(after);<br> center_After = GetBoundsCenter(after.GetBounds());</div>
<div><br> ModifyData();</div>
<div> </div>
<div><br> }</div>
<div><br> private static double[] GetBoundsCenter(double[] bounds)<br> {<br> double[] center = new double[3];</div>
<div><br> center[0] = (bounds[0] + bounds[1]) / 2.0;<br> center[1] = (bounds[2] + bounds[3]) / 2.0;<br> center[2] = (bounds[4] + bounds[5]) / 2.0;</div>
<div><br> return center;<br> }</div>
<div> </div>
<div>Best regards </div></div>