<div dir="ltr"><div class="markdown-here-wrapper" style="font-family:"Lucida Sans",Cantarell,Verdana,sans-serif;color:rgb(11,83,148)"><p style="margin:0px 0px 1.2em!important">Hi Berti,</p>
<p style="margin:0px 0px 1.2em!important">That seems like a bug to me. Mind creating a <a href="https://www.vtk.org/contributing-code/">merge request</a> for your fix?</p>
<p style="margin:0px 0px 1.2em!important">Thanks,<br>Sankhesh</p>
<div title="MDH:SGkgQmVydGksPGRpdj48YnI+PC9kaXY+PGRpdj5UaGF0IHNlZW1zIGxpa2UgYSBidWcgdG8gbWUu
IE1pbmQgY3JlYXRpbmcgYSBbbWVyZ2UgcmVxdWVzdF0oPGEgaHJlZj0iaHR0cHM6Ly93d3cudnRr
Lm9yZy9jb250cmlidXRpbmctY29kZS8iPmh0dHBzOi8vd3d3LnZ0ay5vcmcvY29udHJpYnV0aW5n
LWNvZGUvPC9hPikgZm9yIHlvdXIgZml4PzwvZGl2PjxkaXY+PGJyPjwvZGl2PjxkaXY+VGhhbmtz
LDwvZGl2PjxkaXY+U2Fua2hlc2g8L2Rpdj4=" style="height:0;width:0;max-height:0;max-width:0;overflow:hidden;font-size:0em;padding:0;margin:0">​</div></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Feb 7, 2018 at 1:55 AM Berti Krüger <<a href="mailto:berti_krueger@hotmail.com">berti_krueger@hotmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">As i have seen by walking through the source code of vtkBoxWidget.cxx the<br>
method for resizing the handles vtkBoxWidget::SizeHandles() is first called in<br>
the constructor<br>
<br>
vtkBoxWidget::vtkBoxWidget()<br>
{<br>
  ...<br>
<br>
  // Define the point coordinates<br>
  double bounds[6];<br>
  bounds[0] = -0.5;<br>
  bounds[1] = 0.5;<br>
  bounds[2] = -0.5;<br>
  bounds[3] = 0.5;<br>
  bounds[4] = -0.5;<br>
  bounds[5] = 0.5;<br>
  // Points 8-14 are down by PositionHandles();<br>
  this->PlaceWidget(bounds);<br>
<br>
  ...<br>
}<br>
<br>
<br>
by the method<br>
<br>
<br>
void vtkBoxWidget::PlaceWidget(double bds[6])<br>
{<br>
  ...<br>
  this->SizeHandles();<br>
  ...<br>
}<br>
<br>
<br>
<br>
The method void vtkBoxWidget::SizeHandles() looks like this:<br>
<br>
void vtkBoxWidget::SizeHandles()<br>
{<br>
  double radius = this->vtk3DWidget::SizeHandles(1.5);<br>
  for(int i=0; i<7; i++)<br>
  {<br>
    this->HandleGeometry[i]->SetRadius(radius);<br>
  }<br>
}<br>
<br>
<br>
And it is also called in void vtkBoxWidget::OnLeftButtonUp(), void<br>
vtkBoxWidget::OnMiddleButtonUp() and in void vtkBoxWidget::OnRightButtonUp().<br>
<br>
<br>
So if you click on the widget the line<br>
<br>
double radius = this->vtk3DWidget::SizeHandles(1.5);<br>
<br>
is executed a second time after its execution in the constructor which results<br>
in resizing of the spheres (factor 1.5 again).<br>
<br>
<br>
Anyway. I have now subclassed vtkBoxWidget and have overwritten the<br>
SizeHandles() method and it works now how i need it in my project.<br>
<br>
<br>
Thanks again to the vtk developers for making vtk opensource.<br>
<br>
<br>
Berti Krüger<br>
<br>
<br>
PS: If anyone can help me with some enlightenment regarding the default<br>
behaviour of vtkBoxWidget i would still be glad (e.g. bug or feature?).<br>
<br>
<br>
<br>
Am Wed, 7 Feb 2018 06:21:55 +0000<br>
schrieb Berti Krüger <<a href="mailto:berti_krueger@hotmail.com" target="_blank">berti_krueger@hotmail.com</a>>:<br>
<br>
> It seems i am not the only one who doesn't understand the logic behind the<br>
> sizing of the vtkBoxWidget handles:<br>
><br>
> <a href="http://massmail.spl.harvard.edu/public-archives/slicer-devel/2011/006000.html" rel="noreferrer" target="_blank">http://massmail.spl.harvard.edu/public-archives/slicer-devel/2011/006000.html</a><br>
><br>
> "Hello,<br>
><br>
> I am using a vtkBoxWidget, and it seems the size of the handles depends on<br>
> the ValidPick (to know if handle has been picked or not) (and on the<br>
> renderer to. We have to set a current renderer before calling PlaceWidget.)<br>
><br>
> So, when I am creating the box, ValidPick is 0 because handles have not been<br>
> picked yet.<br>
> The size of the handles is calculate with:<br>
><br>
> return (this->HandleSize * factor * this->InitialLength);<br>
><br>
><br>
> But, when we resize the box, ValidPick change to 1 (on<br>
> OnLeftButtonDown() (same for middle and right button) ), and the size<br>
> is now calculated like this:<br>
><br>
> return (this->HandleSize * factor *  sqrt(radius) );<br>
><br>
><br>
> InitialLength has been replaced by sqrt(radius) (defined on<br>
> vtk3DWidget::SizeHandles)<br>
><br>
> But sqrt(radius) is different from InitalLength.<br>
><br>
> So, when we create a vtkBoxWidget, handles are small, and when we resize it,<br>
> handles are bigger.<br>
><br>
><br>
> Is this normal, or it's a bug ?<br>
><br>
> Thank you.<br>
> Laurent."<br>
><br>
><br>
><br>
> Am Mon, 5 Feb 2018 10:00:16 +0000<br>
> schrieb Berti Krüger <<a href="mailto:berti_krueger@hotmail.com" target="_blank">berti_krueger@hotmail.com</a>>:<br>
><br>
> > Hello Everyone!<br>
> ><br>
> > I am currently using a vtkBoxWidget in my project (VTK 8.1). After i<br>
> > created the vtkBoxWidget, the size handles (= vtkSphereActors) have not been<br>
> > picked yet and are small and nice.<br>
> ><br>
> > But, when I resize the vtkBoxWidget (smaller or larger, it doesn't matter)<br>
> > or simply click on it, the handles get bigger (radius increases) and stay<br>
> > this way.<br>
> ><br>
> > They sometimes tend to get so large that they are piercing the mesh and<br>
> > visually adding themselves to it, which is annoying. And they never get<br>
> > smaller again, sometimes they get even larger.<br>
> ><br>
> > When i zoom out by large amount and then zoom in again, the handles get<br>
> > normal ( = small) again.<br>
> ><br>
> > Is this the intented behaviour, and if so, what is the purpose of it or is<br>
> > it a bug ?<br>
> ><br>
> ><br>
> > Thank you very much in advance.<br>
> ><br>
> ><br>
> > Berti Krüger<br>
> ><br>
> > _______________________________________________<br>
> > Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
> ><br>
> > Visit other Kitware open-source projects at<br>
> > <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
> ><br>
> > Please keep messages on-topic and check the VTK FAQ at:<br>
> > <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
> ><br>
> > Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
> ><br>
> > Follow this link to subscribe/unsubscribe:<br>
> > <a href="https://vtk.org/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://vtk.org/mailman/listinfo/vtkusers</a><br>
><br>
> _______________________________________________<br>
> Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Please keep messages on-topic and check the VTK FAQ at:<br>
> <a href="http://www.vtk.org/Wiki/VTK_FAQ" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
><br>
> Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="https://vtk.org/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://vtk.org/mailman/listinfo/vtkusers</a><br>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://www.vtk.org/Wiki/VTK_FAQ</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=vtkusers" rel="noreferrer" target="_blank">http://markmail.org/search/?q=vtkusers</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://vtk.org/mailman/listinfo/vtkusers" rel="noreferrer" target="_blank">https://vtk.org/mailman/listinfo/vtkusers</a><br>
</blockquote></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div class="inbox-inbox-inbox-inbox-inbox-inbox-inbox-markdown-here-wrapper" style="font-family:"proza libre",sans-serif;color:rgb(0,56,107)"><h5 id="inbox-inbox-inbox-inbox-inbox-inbox-inbox-sankhesh-jhaveri" style="margin:1.3em 0px 1em;padding:0px;font-size:1.1em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);font-weight:bold;color:rgb(11,65,148)">Sankhesh Jhaveri</h5>
<h6 id="inbox-inbox-inbox-inbox-inbox-inbox-inbox--sr-research-development-engineer-kitware-http-www-kitware-com-518-881-4417" style="margin:1.3em 0px 1em;padding:0px;font-size:1em;color:rgb(11,83,148);font-family:"open sans",sans-serif;font-weight:normal"><em>Sr. Research & Development Engineer</em> | <a href="http://www.kitware.com/">Kitware</a> | (518) 881-4417</h6>
<div title="MDH:PGIgc3R5bGU9ImZvbnQtZmFtaWx5OiB2ZXJkYW5hLCBzYW5zLXNlcmlmOyBjb2xvcjogcmdiKDEx
LCA4MywgMTQ4KTsiPjxmb250IHNpemU9IjIiPiMjIyMjU2Fua2hlc2ggSmhhdmVyaTwvZm9udD48
L2I+PGRpdj48Zm9udCBjb2xvcj0iIzBiNTM5NCIgZmFjZT0idmVyZGFuYSwgc2Fucy1zZXJpZiIg
c2l6ZT0iMiI+PGI+PGJyPjwvYj48L2ZvbnQ+PGRpdj48c3BhbiBzdHlsZT0iZm9udC1mYW1pbHk6
IGFyaWFsLCBzYW5zLXNlcmlmOyBjb2xvcjogcmdiKDExLCA4MywgMTQ4KTsiPjxzcGFuIHN0eWxl
PSJmb250LWZhbWlseTogdmVyZGFuYSwgc2Fucy1zZXJpZjsiPjxpPiMjIyMjIypTci4gUmVzZWFy
Y2ggJmFtcDsgRGV2ZWxvcG1lbnQgRW5naW5lZXIqPC9pPiZuYnNwO3wmbmJzcDs8L3NwYW4+PC9z
cGFuPjxzcGFuIHN0eWxlPSJmb250LWZhbWlseTogdmVyZGFuYSwgc2Fucy1zZXJpZjsgY29sb3I6
IHJnYigxMSwgODMsIDE0OCk7Ij48YSBocmVmPSJodHRwOi8vd3d3LmtpdHdhcmUuY29tLyIgdGFy
Z2V0PSJfYmxhbmsiIHN0eWxlPSJjb2xvcjogcmdiKDE3LCA4NSwgMjA0KTsiPktpdHdhcmU8L2E+
Jm5ic3A7fCZuYnNwOzwvc3Bhbj48c3BhbiBzdHlsZT0iZm9udC1mYW1pbHk6IHZlcmRhbmEsIHNh
bnMtc2VyaWY7IGNvbG9yOiByZ2IoMTEsIDgzLCAxNDgpOyI+KDUxOCkgODgxLTQ0MTc8L3NwYW4+
PGJyPjwvZGl2PjxkaXY+PGRpdj48ZGl2PjxzcGFuIHN0eWxlPSJmb250LWZhbWlseTogdmVyZGFu
YSwgc2Fucy1zZXJpZjsgY29sb3I6IHJnYigxMSwgODMsIDE0OCk7Ij48L3NwYW4+PC9kaXY+PC9k
aXY+PC9kaXY+PC9kaXY+" style="height:0px;width:0px;max-height:0px;max-width:0px;overflow:hidden;font-size:0em;padding:0px;margin:0px">​</div></div></div></div>