diff --git a/.gitattributes b/.gitattributes index 5e9fbfdbd02..42450effed1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2446,8 +2446,15 @@ Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/MainWindow.ui -text Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/Periodic_Lloyd_3.qrc -text Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/about_CGAL.html svneol=native#text/html Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/about_Periodic_Lloyd_3.html svneol=native#text/html +Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/Periodic_Lloyd_3.adp -text +Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/images/mainwindow.png -text svneol=unset#image/png +Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/index.html svneol=native#text/html +Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/introduction.html svneol=native#text/html +Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/menu.html svneol=native#text/html Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/icons/cp8.png -text svneol=unset#image/png Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/icons/fileNew.png -text svneol=unset#image/png +Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/icons/fileOpen.png -text svneol=unset#image/png +Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/icons/fileSave.png -text svneol=unset#image/png Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/icons/pause.png -text svneol=unset#image/png Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/icons/planar.png -text svneol=unset#image/png Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/icons/play.png -text svneol=unset#image/png diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt index 165174d4ea5..5c91e319d64 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt +++ b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/CMakeLists.txt @@ -18,6 +18,7 @@ set( QT_USE_QTXML TRUE ) set( QT_USE_QTMAIN TRUE ) set( QT_USE_QTSCRIPT TRUE ) set( QT_USE_QTOPENGL TRUE ) +set( QT_USE_QTASSISTANT TRUE ) find_package(Qt4) find_package(OpenGL) diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/MainWindow.cpp b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/MainWindow.cpp index 0aacf0338ad..2469fd4875d 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/MainWindow.cpp +++ b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/MainWindow.cpp @@ -5,6 +5,15 @@ MainWindow::MainWindow(QWidget* parent): CGAL::Qt::DemosMainWindow(parent) { setupUi(this); this->viewer->setScene(&scene); + + QString loc = QLibraryInfo::location(QLibraryInfo::BinariesPath); + assistantClient = new QAssistantClient(loc, this); + QStringList arguments; + arguments << "-profile" + << QCoreApplication::applicationDirPath() + QDir::separator() + + QString("documentation/Periodic_Lloyd_3.adp"); + assistantClient->setArguments(arguments); + connectActions(); this->addAboutDemo(":/cgal/help/about_Periodic_Lloyd_3.html"); this->addAboutCGAL(); @@ -16,7 +25,6 @@ MainWindow::MainWindow(QWidget* parent): CGAL::Qt::DemosMainWindow(parent) connect(qtimer, SIGNAL(timeout()), this, SLOT(lloydStep())); } - void MainWindow::connectActions() { @@ -52,6 +60,9 @@ MainWindow::connectActions() QObject::connect(this->actionQuit, SIGNAL(triggered()), qApp, SLOT(quit())); + + QObject::connect(this->actionDemo_Help, SIGNAL(triggered()), + this, SLOT(help())); } void @@ -195,6 +206,11 @@ MainWindow::newPoints(int n) emit (sceneChanged()); } +void MainWindow::help() { + QString loc = QCoreApplication::applicationDirPath() + QDir::separator() + + QString("documentation/index.html"); + assistantClient->showPage(loc); +} #include "MainWindow.moc" diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/MainWindow.h b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/MainWindow.h index 6403d169d3b..1ab92867411 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/MainWindow.h +++ b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/MainWindow.h @@ -7,20 +7,28 @@ #include #include #include + +#include +#include + class QWidget; class MainWindow : public CGAL::Qt::DemosMainWindow, private Ui::MainWindow { Q_OBJECT - public: +public: MainWindow(QWidget* = 0); + ~MainWindow() { delete(assistantClient); } void connectActions(); Scene scene; QTimer * qtimer; +private: + QAssistantClient *assistantClient; + public slots: void newPoints(int i); void newPointSet(); @@ -31,6 +39,7 @@ public slots: void toggle8Copies(bool on); void toggle2D(bool on); void lloydStep(); + void help(); signals: void sceneChanged(); diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/MainWindow.ui b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/MainWindow.ui index 6e4da99c907..2be4acad50e 100644 --- a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/MainWindow.ui +++ b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/MainWindow.ui @@ -102,8 +102,15 @@ + + + Help + + + + @@ -236,6 +243,11 @@ Ctrl+S + + + Demo Help + + diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/Periodic_Lloyd_3.adp b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/Periodic_Lloyd_3.adp new file mode 100644 index 00000000000..5aeac57bf2a --- /dev/null +++ b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/Periodic_Lloyd_3.adp @@ -0,0 +1,21 @@ + + + + + + Periodic_Lloyd_3 + CGAL Periodic Lloyd Demo + index.html + . + + + +
+
+
+
+
+ + + + diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/images/mainwindow.png b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/images/mainwindow.png new file mode 100644 index 00000000000..fd7df0799bb Binary files /dev/null and b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/images/mainwindow.png differ diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/index.html b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/index.html new file mode 100644 index 00000000000..136889eb036 --- /dev/null +++ b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/index.html @@ -0,0 +1,29 @@ + + + + Manual + + + +

CGAL Periodic Lloyd Demo

+ + Demo main window + +

+ This is a small demo program that illustrates a periodic + version of the Lloyd algorithm. +

+ + + + + + + diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/introduction.html b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/introduction.html new file mode 100644 index 00000000000..a6a16e85c03 --- /dev/null +++ b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/introduction.html @@ -0,0 +1,30 @@ + + + + Introduction + + + +

Introduction

+

+ This demo implements the Lloyd algorithm in periodic space + using the CGAL 3D periodic triangulations. The algorithm can + be run either on randomly generated point sets or on input + point sets provided in a file. +

+ +

+ The Lloyd algorithm computes the Voronoi diagram and replaces + in each step the input point set by the centroids of their + respective Voronoi cells. +

+ +

+ For more information on 3D periodic triangulations see the + CGAL Periodic Triangulation + package manual. +

+ + + + diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/menu.html b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/menu.html new file mode 100644 index 00000000000..4c774bebcdb --- /dev/null +++ b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/documentation/menu.html @@ -0,0 +1,94 @@ + + + + Menu + + + + +

File

+ + + + + + + + + + + + + + + + +
+ + + New Point Set
+ Asks for the wanted number of points and creates a uniformly + distributed random point set. +
+ + + Load Points
+ Shows a "Open file" dialog. A readable file is supposed to + consist of +
    +
  • an Iso_cuboid_3 given by six values in the order + xmin ymin zmin xmax ymax zmax, separated by white spaces, +
  • a list of points that are separated by white + spaces. A point has to be represented as a list of three + coordinates that again are separated by white spaces. +
+
+ + + Save Points
+ Shows a "Save file" dialog and saves the current points in + the same format as expected by "Load Points". +
+ +

Control

+ + + + + + + + + + + + + + + +
+ + Step
+ Performs one Lloyd step.
+ + Play
+ Starts performing repeated Lloyd steps. +
+ + Show 8 copies
+ Shows eight periodic copies arranged in a 2x2x2 cube. This + is useful for small point sets to better see what the + Voronoi cells look like. +
+ + 2D version
+ Switches to 2D. The 2D version is simulated using the 3D + periodic triangulation, so it is very slow. + The 2D version only works for random point sets. +
+ +
+ The speed slider can be used to increase the pauses between + two separate Lloyd steps. By default the demo runs on maximum + speed. + diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/icons/fileOpen.png b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/icons/fileOpen.png new file mode 100644 index 00000000000..fc6f17e9774 Binary files /dev/null and b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/icons/fileOpen.png differ diff --git a/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/icons/fileSave.png b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/icons/fileSave.png new file mode 100644 index 00000000000..8feec99bee8 Binary files /dev/null and b/Periodic_3_triangulation_3/demo/Periodic_Lloyd_3/icons/fileSave.png differ