cgal icon indicating copy to clipboard operation
cgal copied to clipboard

GSoC'22: New CGAL's design to handle basic viewers

Open gdamiand opened this issue 3 years ago • 86 comments

Fixes https://github.com/CGAL/cgal/issues/6943 Replace PR #6921

Mostafa Ashraf's GSoC 2022 Submission

Mentor: @gdamiand GitHub Page: https://github.com/Mostafa-ashraf19 LinkedIn: Mostafa Ashraf

Link to the Reference Manual

TODOs:

@gdamiand

  • [x] Add Custom KeyPressEvent SimpleSurfaceMeshWithSmallFacesViewerQt, draw_surface_mesh_small_faces.h.
  • [ ] Continue Documenting the project.
  • [ ] Solve bugs that might come after the PR review.
  • [ ] Add something to CHANGES.md

Review

File to review:

  • [x] Boolean_set_operations_2 draw_polygon_set_2.h
  • [x] BGL draw_face_graph.h
  • [x] GraphicsView Buffer_for_vao.h
  • [x] GraphicsView Drawing_functor.h
  • [x] GraphicsView Graphic_buffer.h
  • [x] GraphicsView Basic_viewer_qt.h
  • [x] Linear_cell_complex Viewer.h
  • [x] Linear_cell_complex Viewer.cpp
  • [x] Linear_cell_complex typedefs.h
  • [x] Linear_cell_complex draw_linear_cell_complex.h
  • [x] Nef_3 draw_nef_3.h
  • [x] Periodic_2_triangulation_2 draw_periodic_2_triangulation_2.h
  • [x] Point_set_3 draw_point_set_3.h
  • [x] Polygon draw_polygon_2.h
  • [x] Polygon draw_polygon_with_holes_2.h
  • [x] Polyhedron draw_polyhedron.h
  • [x] Straight_skeleton_2 draw_straight_skeleton_2.h
  • [x] Surface_mesh/examples/Surface_mesh/draw_surface_mesh_small_faces.h
  • [x] Surface_mesh draw_surface_mesh.h
  • [x] Surface_mesh_topology/examples/Surface_mesh_topology/draw_facewidth.h
  • [x] Surface_mesh_topology/examples/Surface_mesh_topology/unsew_edgewidth_repeatedly.cpp
  • [x] Surface_mesh_topology draw_face_graph_with_paths.h
  • [x] Triangulation_2 draw_triangulation_2.h
  • [x] draw_constrained_triangulation_2.h
  • [x] Triangulation_3 draw_triangulation_3.h
  • [x] Voronoi_diagram_2 draw_voronoi_diagram_2.h

Ref manual

Document all draw and add_to_graphics_scene functions:

  • [x] ./Triangulation_2/doc/Triangulation_2/CGAL/draw_triangulation_2.h
  • [x] ./Triangulation_2/doc/Triangulation_2/CGAL/draw_constrained_triangulation_2.h
  • [x] ./Surface_mesh_topology/doc/Surface_mesh_topology/CGAL/draw_face_graph_with_paths.h
  • [x] ./Triangulation_3/doc/Triangulation_3/CGAL/draw_triangulation_3.h
  • [x] ./Arrangement_on_surface_2/doc/Arrangement_on_surface_2/CGAL/draw_arrangement_2.h
  • [x] ./Polygon/include/CGAL/draw_polygon_2.h
  • [x] ./Polygon/include/CGAL/draw_polygon_with_holes_2.h
  • [x] ./Polyhedron/doc/Polyhedron/CGAL/draw_polyhedron.h
  • [x] ./Surface_mesh/include/CGAL/draw_surface_mesh.h
  • [x] ./Nef_3/doc/Nef_3/CGAL/draw_nef_3.h
  • [x] ./Periodic_2_triangulation_2/doc/Periodic_2_triangulation_2/CGAL/draw_periodic_2_triangulation_2.h
  • [x] ./Voronoi_diagram_2/doc/Voronoi_diagram_2/CGAL/draw_voronoi_diagram_2.h
  • [x] ./Linear_cell_complex/doc/Linear_cell_complex/CGAL/draw_linear_cell_complex.h
  • [x] ./Point_set_3/include/CGAL/draw_point_set_3.h
  • [x] ./Boolean_set_operations_2/doc/Boolean_set_operations_2/CGAL/draw_polygon_set_2.h

gdamiand avatar Oct 14 '22 07:10 gdamiand

[WIP] TODOs

File to review:

    • [x] CGAL_basic_viewers/examples/CGAL_basic_viewers/draw_surface_mesh_small_faces.cpp -> draw faces for a specific threshold.
    • [x] Surface_mesh/examples/Surface_mesh/draw_surface_mesh_small_faces.h

Documentation:

    • [ ] WIP,

Note: I'll update this periodically.

ping, @gdamiand

Mostafa-ashraf19 avatar Dec 08 '22 15:12 Mostafa-ashraf19

Does this PR in any way have to do with the replacement of QGLWidget by QOpenGLWidget? If I understand correctly you use the latter already in the simple viewer, but the polyhedron demo still uses the former.

afabri avatar Jan 04 '23 16:01 afabri

Does this PR in any way have to do with the replacement of QGLWidget by QOpenGLWidget? If I understand correctly you use the latter already in the simple viewer, but the polyhedron demo still uses the former.

Not at all; but in the basic viewer I only use QGLViewer and not directly QGLWidget nor QOpenGLWidget.

And it seems also the case for the polyhedron demo:

doing a grep for QGLWidget gives me only Polyhedron/Scene.cpp:#include <QGLWidget>, maybe this include can be removed ?

And doing a grep for QOpenGLWidget gives me only Polyhedron/Viewer.cpp: QOpenGLWidget::makeCurrent(); which can probably be replaced by a QGLViewer::makeCurrent() ?

gdamiand avatar Jan 04 '23 17:01 gdamiand

I have a question, that of topic: can the basic viewer draw to a 2D image (QImage), to make screenshots? ...Actually, my real goal would be to create thumbnails automatically from mesh files (.obj, .vtk, .off, .ply, .stl...). My idea would be to use the basic viewer, in a special mode that does not display on screen, set the scene, and create an image, similar to that one for example (but smaller, and with a tighter zoom) : https://cdn.thingiverse.com/assets/84/1b/a3/ba/10/featured_preview_dd7a7021-42cc-4bac-9937-47e8413fc0da.png (from Thingiverse).

lrineau avatar Sep 27 '23 14:09 lrineau

I have a question, that of topic: can the basic viewer draw to a 2D image (QImage), to make screenshots? ...Actually, my real goal would be to create thumbnails automatically from mesh files (.obj, .vtk, .off, .ply, .stl...). My idea would be to use the basic viewer, in a special mode that does not display on screen, set the scene, and create an image, similar to that one for example (but smaller, and with a tighter zoom) : https://cdn.thingiverse.com/assets/84/1b/a3/ba/10/featured_preview_dd7a7021-42cc-4bac-9937-47e8413fc0da.png (from Thingiverse).

For now this is not possible; but I also would like to have such a possibility, and maybe the work to do is not important. I suggest to integrate this pr, then work on this possibility as new feature.

gdamiand avatar Sep 27 '23 14:09 gdamiand

/build:v29-09-2023

gdamiand avatar Sep 29 '23 06:09 gdamiand

There was an error while building the doc:

/home/runner/work/cgal/cgal/Documentation/doc/Documentation/packages.txt:1820: warning: image file TODO.png is not found in IMAGE_PATH: assuming external image.
warning: source '/home/runner/work/cgal/cgal/Basic_viewer/doc/Basic_viewer/fig' is not a readable file or directory... skipping.
/home/runner/work/cgal/cgal/Basic_viewer/doc/Basic_viewer/PackageDescription.txt:11: warning: image file TODO.png is not found in IMAGE_PATH: assuming external image.
/home/runner/work/cgal/cgal/Linear_cell_complex/doc/Linear_cell_complex/CGAL/draw_linear_cell_complex.h:6: warning: The following parameter of CGAL::draw(const LCC &alcc, const GSOptions &gs_options) is not documented:
  parameter 'gs_options'

https://github.com/CGAL/cgal/actions/runs/6348023712

github-actions[bot] avatar Sep 29 '23 06:09 github-actions[bot]

/build:v02-10-2023

gdamiand avatar Oct 02 '23 07:10 gdamiand

There was an error while building the doc:

/home/runner/work/cgal/cgal/Linear_cell_complex/doc/Linear_cell_complex/CGAL/draw_linear_cell_complex.h:6: warning: The following parameter of CGAL::draw(const LCC &alcc, const GSOptions &gs_options) is not documented:
  parameter 'gs_options'

https://github.com/CGAL/cgal/actions/runs/6376973726

github-actions[bot] avatar Oct 02 '23 07:10 github-actions[bot]

/build:v02-10-2023

gdamiand avatar Oct 02 '23 07:10 gdamiand

The documentation is built. It will be available, after a few minutes, here: https://cgal.github.io/6967/v02/Manual/index.html

github-actions[bot] avatar Oct 02 '23 07:10 github-actions[bot]

/build:v06-10-2023

gdamiand avatar Oct 06 '23 05:10 gdamiand

The documentation is built. It will be available, after a few minutes, here: https://cgal.github.io/6967/v06/Manual/index.html

github-actions[bot] avatar Oct 06 '23 05:10 github-actions[bot]

/build:v06-18-2023

gdamiand avatar Oct 18 '23 06:10 gdamiand

There was an error while building the doc:

This round already exists. Overwrite it with /force-build.

https://github.com/CGAL/cgal/actions/runs/6556984844

github-actions[bot] avatar Oct 18 '23 06:10 github-actions[bot]

/force-build:v06-18-2023

gdamiand avatar Oct 18 '23 06:10 gdamiand

The documentation is built. It will be available, after a few minutes, here: https://cgal.github.io/6967/v06/Manual/index.html

github-actions[bot] avatar Oct 18 '23 06:10 github-actions[bot]

I also pushed two commits directly.

  • As for the quotes for nullptr (95d7bd7476bac9612fcb4c815392dcbbce8922a9), I have the impression that a lot more quotes are required.
  • As for the copy-paste typo (c7578f456d2c88842aa23a9ceff241f082b4c387), there might be more. I just saw that one by accident, while trying to understand how "mono colors" where implemented.

lrineau avatar Oct 18 '23 13:10 lrineau

What happened to the documentation built in this PR ??

afabri avatar Oct 18 '23 14:10 afabri

/build:v0

gdamiand avatar Oct 20 '23 12:10 gdamiand

There was an error while building the doc:

This round already exists. Overwrite it with /force-build.

https://github.com/CGAL/cgal/actions/runs/6587914797

github-actions[bot] avatar Oct 20 '23 12:10 github-actions[bot]

/force-build:v0

gdamiand avatar Oct 20 '23 12:10 gdamiand

The documentation is built. It will be available, after a few minutes, here: https://cgal.github.io/6967/v0/Manual/index.html

github-actions[bot] avatar Oct 20 '23 12:10 github-actions[bot]

/force-build:v0

gdamiand avatar Oct 22 '23 15:10 gdamiand

The documentation is built. It will be available, after a few minutes, here: https://cgal.github.io/6967/v0/Manual/index.html

github-actions[bot] avatar Oct 22 '23 15:10 github-actions[bot]

/force-build:v0

afabri avatar Oct 23 '23 12:10 afabri

The documentation is built. It will be available, after a few minutes, here: https://cgal.github.io/6967/v0/Manual/index.html

github-actions[bot] avatar Oct 23 '23 12:10 github-actions[bot]

/force-build:v0

gdamiand avatar Oct 23 '23 13:10 gdamiand

The documentation is built. It will be available, after a few minutes, here: https://cgal.github.io/6967/v0/Manual/index.html

github-actions[bot] avatar Oct 23 '23 13:10 github-actions[bot]

/force-build:v0

gdamiand avatar Oct 23 '23 17:10 gdamiand