mirror of https://github.com/CGAL/cgal
54 lines
2.2 KiB
TeX
54 lines
2.2 KiB
TeX
% viewer
|
|
|
|
% show how to
|
|
% iterate
|
|
% circulate
|
|
% enrich primitives
|
|
|
|
This tutorial implements an interactive basic polyhedron viewer based
|
|
on the \cgalpoly\ with the default configuration. This viewer
|
|
demonstrates basic functionalities of a \cgalpoly . We show the mesh
|
|
traversal based on the \italic{iterators} and the \italic{circulators}
|
|
during the assembly of facet polygons for basic OpenGL rendering. The
|
|
viewer is then extended by customizing the \poly\ with extra
|
|
attributes and functionalities. This enriched polyhedron supports
|
|
facet and vertex normals for rendering, an axis-aligned bounding box
|
|
of the polyhedron, and provides geometry items specialized with
|
|
algorithmic flags. A number of rendering modes are available to the
|
|
user depending on the choices of lighting, shading and edge
|
|
superimposing. The superimposition of the control mesh on the
|
|
subdivision surfaces is implemented for the quad-triangle scheme with
|
|
a boolean flag of the halfedge item, this flag being automatically
|
|
propagated to the subdivided edges during subdivision (\figurename\
|
|
\ref{fig:quad-triangle}).
|
|
|
|
% basic combinatorial algorithms
|
|
|
|
The tutorial demonstrates basic combinatorial algorithms on the
|
|
connectivity of the polyhedron by counting the number of connected
|
|
components and boundaries, and deducing the combinatorial genus of the
|
|
active polyhedron.
|
|
|
|
% OBJ format import/export
|
|
|
|
In addition to the build-in features of OFF file I/O in \cgal ,
|
|
we show how to import a polyhedron file in the OBJ format based on the
|
|
\italic{modifier callback mechanism} and the \italic{incremental
|
|
builder}. The OBJ file exporting is simply based on mesh
|
|
traversal.
|
|
|
|
% camera
|
|
|
|
The camera and transformation states are automatically adjusted when a
|
|
new polyhedron is loaded so as to originally view the model in all. A
|
|
function snapshots the camera and transformation states for the sake
|
|
of comparing two models with the same viewpoint.
|
|
|
|
% goodies
|
|
|
|
The viewer also features a raster output of the current client image
|
|
to the clipboard, as well as a vectorial output to a postscript
|
|
file. Note however that the latter functionality is not based on the
|
|
painter algorithm and performs instead a simple z-sorting of the
|
|
polygons based on each facet barycenter and the current viewpoint.
|