diff --git a/_posts/2024-07-02-Basic_viewer.md b/_posts/2024-07-02-Basic_viewer.md index 087f7398b..8cd4164f4 100644 --- a/_posts/2024-07-02-Basic_viewer.md +++ b/_posts/2024-07-02-Basic_viewer.md @@ -13,7 +13,25 @@ Mostafa Ashraf.
CGAL being the computational geometry algorithms library, it is often required to visualize a given data structure of the results of a certain algorithm. Since CGAL 4.13, global functions draw exist allowing to visualize (almost) all the CGAL data structures. Call a draw function opens a new interactive window showing the given model and allowing to navigate in the scene, show or hide some specific cells, show the interior of the model if any, etc.
+CGAL being the computational geometry algorithms library, it is often required to visualize a given data structure of the results of a certain algorithm. Since CGAL 4.13, global functions draw
exist allowing to visualize (almost) all the CGAL data structures. Call a draw
function opens a new interactive window showing the given model and allowing to navigate in the scene, show or hide some specific cells, show the interior of the model if any, etc.
The example below illustrates how we can use such a draw
function to visualize an off file loaded into a Surface_mesh
data structure.
+#include <CGAL/Simple_cartesian.h>
+#include <CGAL/Surface_mesh.h>
+#include <CGAL/draw_surface_mesh.h>
+
+int main(int argc, char* argv[])
+{
+ using Point=CGAL::Simple_cartesian::Point_3;
+ CGAL::Surface_mesh sm;
+ CGAL::IO::read_polygon_mesh(argv[1], sm);
+ CGAL::draw(sm);
+ return EXIT_SUCCESS
+}
+
However this solutions has several limitations. It is not easy to customize the drawing (changing the color or hiding of some elements); it is not possible to draw different data structures simultaneously; it is not easy to add interaction with the drawing or to use it in an higher level widget. All these limitations are solved in this new package: the CGAL Basic viewer.