<div dir="ltr">Dear Jim Peterson<div><br></div><div>I use vtk version 4 the .NET wrapper , </div><div>and I use getpolydata then getbound ,any suggestion to get the center after and before to use it in detect the displacement calculation</div>
<div><br></div><div>Best regards <br><br><div class="gmail_quote">On Tue, Aug 24, 2010 at 9:11 PM, Jim Peterson <span dir="ltr"><<a href="mailto:jimcp@cox.net">jimcp@cox.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Eric, Ali and all,<br>
<br>
Fwiw, it was my misinterpretation of Ali's original source code that pointed us at Java. I believe Ali is actually using a .net wrapper and therefore a Windows host platform. The Addobserver and callback signatures in his example code do not match the corresponding Java versions, and I do not have a .net environment to test directly in. In order to make a Java version for testing, I had to wrap Ali's original logic in a class, and I had to make the callbacks instance functions instead of class functions (static) as originally coded. I don't believe these changes should have affected my results, but they are all factors for potential differences.<br>
<br>
I am learning VTK as we go as well, but I suspect we will need to make use of the picker callbacks as opposed to the Interaction callbacks to address the selected boxWidget. If my exploration uncovers anything I will post my results.<br>
<br>
Ali, exactly what version of VTK are you using? I have been testing with the 5.6.0 version myself, and my understanding is the Java wrappers where significantly modified. I wonder if there is any corresponding change required for the .NET wrapper (wherever that comes from).<br>
<br>
Hope that helps,<br><font color="#888888">
Jim</font><div><div></div><div class="h5"><br>
<br>
Eric E. Monson wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hey Ali,<br>
<br>
That's strange. I don't have a Java wrappers build right now, but I tried modifying the Examples/Tutorial/Step6/.../Cone6 example for both Python and Cxx and both of them give me back modified bounds as I move the box widget... They both use InteractionEvent, and if I print the bounds in the callback I see the numbers changing as I move the box...<br>
<br>
I was going to suggest trying to add your GetPolyData and GetBounds calls to the event callback in Step6.java, but I see that doesn't exist!<br>
<br>
So, I don't want to get too off-topic with Ali's problem, but does anyone know why there isn't a Step6.java? I don't use the Java wrappers much -- are there any special issues with the BoxWidget and Java?<br>
<br>
Hopefully someone else can be more help,<br>
-Eric<br>
<br>
------------------------------------------------------<br>
Eric E Monson<br>
Duke Visualization Technology Group<br>
<br>
<br>
On Aug 24, 2010, at 2:44 AM, Ali Habib wrote:<br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi All,<br>
I want to get the center fo the vtkbox widget at the beginning of moving it and at the end of moving it<br>
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<br>
any suggestion to solve that<br>
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();<br>
<br>
vtkPolyData before = new vtkPolyData();<br>
widget.GetPolyData(before);<br>
center_Before = GetBoundsCenter(before.GetBounds());<br>
<br>
//maceActor.VisibilityOff();<br>
///////////// Test writting /////////////////////////////////////////////<br>
//Write the file<br>
<br>
/*vtkXMLPolyDataWriter writer = new vtkXMLPolyDataWriter ();<br>
writer.SetInputConnection(clipper.GetOutputPort());<br>
writer.SetFileName("disk.vtp");<br>
writer.Write();*/<br>
<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());<br>
<br>
ModifyData();<br>
<br>
}<br>
<br>
private static double[] GetBoundsCenter(double[] bounds)<br>
{<br>
double[] center = new double[3];<br>
<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;<br>
<br>
return center;<br>
}<br>
Best regards<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
</blockquote>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the VTK FAQ at: <a href="http://www.vtk.org/Wiki/VTK_FAQ" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.vtk.org/mailman/listinfo/vtkusers" target="_blank">http://www.vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
<br>
</blockquote>
<br>
</div></div></blockquote></div><br></div></div>