[vtkusers] scale vtkPlaneWidget

Agata Krasoń agatakrason at gmail.com
Mon Mar 3 09:43:36 EST 2014


Hi,

I have  question concerning vtkPlaneWidget.
I need to scale vtkPlaneWidget.
I can not scalling well these widget.
*planeWidget->GetProp3D()->SetScale(scale, scale, scale);*
It doesn't work well.
I always received an exception :
TestImagePlaneWidget.exe: 0xC0000005: Access violation reading location
0x00000000.

Could You help me please ?

Tested  program :

int main ( int argc, char *argv[] )
{
  vtkSmartPointer<vtkSphereSource> sphereSource =
vtkSmartPointer<vtkSphereSource>::New();
  vtkSmartPointer<vtkPolyDataMapper> mapper =
vtkSmartPointer<vtkPolyDataMapper>::New();
  mapper->SetInputConnection(sphereSource->GetOutputPort());
  vtkSmartPointer<vtkActor> actor = vtkSmartPointer<vtkActor>::New();
  actor->SetMapper(mapper);

  // Visualization
  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<vtkSplineWidget2> splineWidget =
vtkSmartPointer<vtkSplineWidget2>::New();
  splineWidget->SetInteractor(renderWindowInteractor);

  vtkSmartPointer<vtkImagePlaneWidget> planeWidget =
vtkSmartPointer<vtkImagePlaneWidget>::New();
  planeWidget->SetInteractor(renderWindowInteractor);
 /* double iso_scale[3] = {1,1,0};
  double p1[3] = {0,0,0};
  double p2[3] = {0,100,0};*/
  double scale = 10;
  //planeWidget->GetPoint1(p1);
  //planeWidget->GetPoint2(p2);
*  planeWidget->GetProp3D()->SetScale(scale, scale, scale);  // ? *

 // planeWidget->GetProp3D()->SetScale(iso_scale);

  renderer->AddActor(actor);
  renderer->ResetCamera();
  planeWidget->On();
  splineWidget->On();
  renderer->SetBackground(.3, .6, .3);
  renderWindow->Render();
  renderWindowInteractor->Start();

  return EXIT_SUCCESS;
}


I would appreciate for any help please :)

Agatte
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20140303/a2ffb113/attachment.html>


More information about the vtkusers mailing list