[vtkusers] wxPlaneWidget on OSX

ABE Hiroshi habe36 at gmail.com
Wed Apr 6 21:21:15 EDT 2016


Dear All,

I found the reason why the problem occurs.

Dragging the handle and then stop to set the vector of motion of mouse pointer to zero vector in “vtkPlaneWIdget::MovePoint?” methods.
The vector is expected not to be zero but it is on OSX. I put statement to prevent zero divide as;
    // Project v onto these vector to determine the amount of motion
    // Scale it by the relative size of the motion to the vector length
    double d1, d2;
    if( vN == 0 ) {
        d1 = 0.0;
        d2 = 0.0;
    } else {
        d1 = (vN/n10) * vtkMath::Dot(v,p10) / (vN*n10);
        d2 = (vN/n20) * vtkMath::Dot(v,p20) / (vN*n20);
    }
to work fine for me.

Tchuss,

2016/04/06 16:57、ABE Hiroshi <habe36 at gmail.com> のメール:

> Dear All,
> 
> I modified the VTK wiki’s sample as is bottom of this mail to show the status of vtkPlaneWidget.
> The output of “Print” method in the constructor is;
> 
> vtkPlaneWidget (0x7fea78d1e1d0)
>  Debug: Off
>  Modified Time: 2705
>  Reference Count: 1
>  Registered Events: (none)
>  Current Renderer: 0x0
>  Default Renderer: 0x0
>  Enabled: 0
>  Priority: 0.5
>  Interactor: 0x0
>  Key Press Activation: On
>  Key Press Activation Value: i
>  Prop3D: 0x0
>  Input: 0x0
>  Handle Size: 0.05
>  Place Factor: 0.5
>  Handle Property: 0x7fea78d4a2c0
>  Selected Handle Property: 0x7fea78d4a470
>  Plane Property: 0x7fea78d4a620
>  Selected Plane Property: 0x7fea78d4a7d0
>  Plane Representation: Wireframe
>  Normal To X Axis: Off
>  Normal To Y Axis: Off
>  Normal To Z Axis: Off
>  Resolution: 4
>  Origin: (-0.5, -0.5, 0)
>  Point 1: (0.5, -0.5, 0)
>  Point 2: (-0.5, 0.5, 0)
> 
> and in the destructor;
> 
> vtkPlaneWidget (0x7fea78d1e1d0)
>  Debug: Off
>  Modified Time: 2806
>  Reference Count: 0
>  Registered Events: (none)
>  Current Renderer: 0x7fea78f00160
>  Default Renderer: 0x0
>  Enabled: 1
>  Priority: 0.5
>  Interactor: 0x7fea78f00b40
>  Key Press Activation: On
>  Key Press Activation Value: i
>  Prop3D: 0x0
>  Input: 0x0
>  Handle Size: 0.05
>  Place Factor: 0.5
>  Handle Property: 0x7fea78d4a2c0
>  Selected Handle Property: 0x7fea78d4a470
>  Plane Property: 0x7fea78d4a620
>  Selected Plane Property: 0x7fea78d4a7d0
>  Plane Representation: Wireframe
>  Normal To X Axis: Off
>  Normal To Y Axis: Off
>  Normal To Z Axis: Off
>  Resolution: 4
>  Origin: (-0.562965, -0.555969, 0)
>  Point 1: (nan, nan, nan)
>  Point 2: (nan, nan, nan)
> 
> The Point 1 and 2 are changed to “nan”. The value (X,Y) in OnMouseMove is not strange as;
> ( 182, 172 ) 
> ( 180, 170 ) 
> ( 180, 169 ) 
> ( 177, 169 ) 
> ( 177, 167 ) 
> ( 175, 167 ) 
> ( 174, 166 ) 
> ( 174, 165 ) 
> ( 173, 165 ) 
> ( 218, 212 ) 
> ( 219, 213 ) 
> ( 221, 215 ) 
> ( 222, 217 ) 
> ( 224, 218 ) 
> ( 225, 221 ) 
> ( 226, 222 ) 
> ( 227, 224 ) 
> ( 229, 225 ) 
> ( 230, 225 ) 
> ( 232, 227 ) 
> ( 235, 229 ) 
> ( 237, 231 ) 
> ( 241, 234 ) 
> ( 244, 235 ) 
> ( 246, 236 ) 
> ( 247, 238 ) 
> ( 249, 238 ) 
> ( 250, 238 ) 
> ( 250, 239 ) 
> ( 252, 239 ) 
> ( 253, 241 ) 
> ( 253, 241 ) 
> ( 255, 241 ) 
> ( 255, 242 ) 
> ( 255, 244 ) 
> ( 256, 244 ) 
> ( 256, 244 ) 
> ( 258, 244 ) 
> 
> This is the result of my investigation on this.
> 
> Still I am looking for any suggestions on this.
> Thank you.
> 
> 2016/04/05 11:28、ABE Hiroshi <habe36 at gmail.com> のメール:
> 
>> Dear all,
>> 
>> This might be a known issue but I could find any description about it on the net so I ask you about vtkPlaneWidget.
>> That is a weired behavior that the handles of vtkPlaneWidget is gone when you drag one of the handles.
>> 
>> The sample program I used is available at:
>> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/PlaneWidget
>> 
>> Building it straightforwardly and get an executable program. The application launches as usual to display a VTK window.
>> You can find a vtkPlaneWidget’s plane in the window, which has four handles. If you drag one of the handles suddenly the handle disappears. This is always happens on OSX (10.9.5, 10.10.5). The env. are:
>> 
>> OS X 10.9.5 (iMac late 2013 21.5”) VTK 5.10.1 (with Apple Wireless Trackpad)
>> OS X 10.10.5 (MBP Letina 13”) VTK 5.10.1 VTK 6.3.0
>> 
>> As an additional info. Run the same program on OpenSUSE 13 (VTK 5.10) on the Linux box itself, it works fine as expected. But if you display on iMac with XQuartz (2.7.8), the same problem happens.
>> 
>> Anybody out there point me the way workaround or any suggestions to solve this.
>> 
>> Thank you very much in advance.
> 
> ABE Hiroshi
> from Tokorozawa, JAPAN
> 
> #include <iostream>
> 
> #include <vtkPlaneWidget.h>
> #include <vtkRenderer.h>
> #include <vtkRenderWindow.h>
> #include <vtkRenderWindowInteractor.h>
> #include <vtkSmartPointer.h>
> #include <vtkObjectFactory.h>
> 
> class myPlaneWidget : public vtkPlaneWidget {
> public:
>    static myPlaneWidget *New();
>    myPlaneWidget() : vtkPlaneWidget() {
>        this->Print( std::cout );
>    }
>    virtual ~myPlaneWidget() {
>        this->Print( std::cout );
>    }
>    virtual void UpdatePlacement() {
>        this->Print( std::cout );
>        vtkPlaneWidget::UpdatePlacement();
>    }
>    virtual void PositionHandles() {
>        this->Print( std::cout );
>        vtkPlaneWidget::PositionHandles();
>    }
> };
> vtkStandardNewMacro(myPlaneWidget);
> 
> int main(int, char *[])
> {
>    vtkSmartPointer<vtkRenderer> renderer =
>    vtkSmartPointer<vtkRenderer>::New();
> 
>    vtkSmartPointer<vtkRenderWindow> renderWindow =
>    vtkSmartPointer<vtkRenderWindow>::New();
>    renderWindow->AddRenderer(renderer);
> 
>    vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
>    vtkSmartPointer<vtkRenderWindowInteractor>::New();
>    renderWindowInteractor->SetRenderWindow(renderWindow);
> 
>    vtkSmartPointer<myPlaneWidget> planeWidget =
>    vtkSmartPointer<myPlaneWidget>::New();
>    planeWidget->SetInteractor(renderWindowInteractor);
> 
>    planeWidget->On();
> 
>    renderWindowInteractor->Initialize();
> 
>    renderer->ResetCamera();
>    renderWindow->Render();
> 
>    renderWindowInteractor->Start();
> 
>    return EXIT_SUCCESS;
> }
> 
> _______________________________________________
> 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

ABE Hiroshi
 from Tokorozawa, JAPAN



More information about the vtkusers mailing list