Difference between revisions of "VTK/Examples/Cxx/Widgets/AngleWidget"

From KitwarePublic
< VTK‎ | Examples‎ | Cxx
Jump to: navigation, search
 
Line 1: Line 1:
<div class="floatright">[[File:VTK_Examples_Baseline_Widgets_TestAngleWidget.png]]</div>
+
= '''See [https://lorensen.github.io/VTKExamples/site/Cxx/Widgets/AngleWidget2D AngleWidget2D] on the new [https://lorensen.github.io/VTKExamples/site/ VTKExamples website].''' =
Click three points to create an angle. You can then drag the points around.
 
 
 
==AngleWidget.cxx==
 
<source lang="cpp">
 
#include <vtkPolyDataMapper.h>
 
#include <vtkActor.h>
 
#include <vtkRenderWindow.h>
 
#include <vtkRenderer.h>
 
#include <vtkRenderWindowInteractor.h>
 
#include <vtkPolyData.h>
 
#include <vtkSmartPointer.h>
 
#include <vtkSphereSource.h>
 
#include <vtkAngleWidget.h>
 
 
 
int main(int, char *[])
 
{
 
  // A renderer and render window
 
  vtkSmartPointer<vtkRenderer> renderer =
 
    vtkSmartPointer<vtkRenderer>::New();
 
  vtkSmartPointer<vtkRenderWindow> renderWindow =
 
    vtkSmartPointer<vtkRenderWindow>::New();
 
  renderWindow->AddRenderer(renderer);
 
 
 
  // An interactor
 
  vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor =
 
    vtkSmartPointer<vtkRenderWindowInteractor>::New();
 
  renderWindowInteractor->SetRenderWindow(renderWindow);
 
 
 
  vtkSmartPointer<vtkAngleWidget> angleWidget =
 
    vtkSmartPointer<vtkAngleWidget>::New();
 
  angleWidget->SetInteractor(renderWindowInteractor);
 
  angleWidget->CreateDefaultRepresentation();
 
 
 
  // Render
 
  renderWindow->Render();
 
  renderWindowInteractor->Initialize();
 
  renderWindow->Render();
 
  angleWidget->On();
 
  renderWindowInteractor->Start();
 
 
 
  return EXIT_SUCCESS;
 
}
 
 
 
</source>
 
 
 
{{VTKCMakeLists|{{SUBPAGENAME}}}}
 
 
 
Blank (black) image is displayed.
 
[[Category:VTKMakeMoreInteresting]]
 

Latest revision as of 21:30, 19 February 2019

See AngleWidget2D on the new VTKExamples website.