CGAL::Qt_widget_Nef_S2<Nef_polyhedron_S2>

Definition

The class Qt_widget_Nef_S2 uses the OpenGL interface of Qt in order to display a Nef_polyhedron_S2. Its purpose is to provide an easy to use viewer for Nef_polyhedron_S2. There are no means provided to enhance the functionality of the viewer.

In addition to the functions inherited from the Qt class QGLWidget, Qt_widget_Nef_S2 only has a single public constructor. For the usage of Qt_widget_Nef_S2 see the example below.

#include <CGAL/IO/Qt_widget_Nef_S2.h>

Parameters

The template parameter expects an instantiation of Nef_polyhedron_S2<Traits>.

Creation

Qt_widget_Nef_S2<Nef_polyhedron_S2> W ( Nef_polyhedron_S2 N);
Creates a widget W for displaying the Nef_polyhedron_S2 N.

See Also

CGAL::Nef_polyhedron_S2<Traits>

Example

This example create some random Sphere_segments and distributes them on two Nef_polyhedron_2. The two Nef polyhedra are combined by a symmetric diffrence and the result is displayed in a Qt widget.

File: demo/Nef_S2/visualization.cpp
#include <CGAL/basic.h>

#ifndef CGAL_USE_QT
#include <iostream>
int main(int, char*){
  std::cout << "Sorry, this demo needs QT..." << std::endl; return 0;}
#else
#include <CGAL/Gmpz.h>
#include <CGAL/Homogeneous.h>
#include <CGAL/Nef_polyhedron_S2.h>
#include <CGAL/Nef_S2/create_random_Nef_S2.h>
#include <CGAL/IO/Qt_widget_Nef_S2.h>
#include <qapplication.h>

typedef CGAL::Gmpz RT;
typedef CGAL::Homogeneous<RT> Kernel;
typedef CGAL::Nef_polyhedron_S2<Kernel> Nef_polyhedron_S2;

int main(int argc, char* argv[]) {

  Nef_polyhedron_S2 S;
  create_random_Nef_S2(S,5);

  QApplication a(argc, argv);
  CGAL::Qt_widget_Nef_S2<Nef_polyhedron_S2>* w =
    new CGAL::Qt_widget_Nef_S2<Nef_polyhedron_S2>(S);
  a.setMainWidget(w);
  w->show();
  return a.exec();
}
#endif