#include #include #include #include #include #include #include #include #include #include #include #include #include #include int main (int, char *[]) { // Sphere vtkSmartPointer sphereSource = vtkSmartPointer::New(); sphereSource->SetCenter(-4.0, 0.0, 0.0); sphereSource->SetRadius(4.0); vtkSmartPointer sphereMapper = vtkSmartPointer::New(); sphereMapper->SetInputConnection(sphereSource->GetOutputPort()); vtkSmartPointer sphereActor = vtkSmartPointer::New(); sphereActor->SetMapper(sphereMapper); // Regular Polygon vtkSmartPointer regularPolygonSource = vtkSmartPointer::New(); regularPolygonSource->SetCenter(4.0, 0.0, 0.0); regularPolygonSource->SetRadius(4.0); vtkSmartPointer regularPolygonMapper = vtkSmartPointer::New(); regularPolygonMapper->SetInputConnection(regularPolygonSource->GetOutputPort()); vtkSmartPointer regularPolygonActor = vtkSmartPointer::New(); regularPolygonActor->SetMapper(regularPolygonMapper); // A renderer and render window vtkSmartPointer renderer = vtkSmartPointer::New(); vtkSmartPointer renderWindow = vtkSmartPointer::New(); renderWindow->AddRenderer(renderer); // An interactor vtkSmartPointer renderWindowInteractor = vtkSmartPointer::New(); renderWindowInteractor->SetRenderWindow(renderWindow); // Create the widget vtkSmartPointer balloonRep = vtkSmartPointer::New(); balloonRep->SetBalloonLayoutToImageRight(); vtkSmartPointer balloonWidget = vtkSmartPointer::New(); balloonWidget->SetInteractor(renderWindowInteractor); balloonWidget->SetRepresentation(balloonRep); balloonWidget->AddBalloon(sphereActor, "This is a sphere",NULL); balloonWidget->AddBalloon(regularPolygonActor, "This is a regular polygon",NULL); // Add the actors to the scene renderer->AddActor(sphereActor); renderer->AddActor(regularPolygonActor); // Render an image (lights and cameras are created automatically) renderWindow->Render(); balloonWidget->EnabledOn(); // Begin mouse interaction renderWindowInteractor->Start(); return EXIT_SUCCESS; }