Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

Revision c2ea6fbae2634487a33181bb44d1508b19a4507c authored by Jan Möbius on 23 November 2022, 15:04:04 UTC, committed by Jan Möbius on 23 November 2022, 15:04:04 UTC
Merge branch 'fix_calc_normal_for_edges' into 'master'
Fix calc_normal for edges

See merge request OpenMesh/OpenMesh!325
2 parent s 3f328cd + 121ff40
  • Files
  • Changes
  • 2d0c205
  • /
  • Doc
  • /
  • tutorial_04.docu
Raw File Download

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • revision
  • directory
  • content
revision badge
swh:1:rev:c2ea6fbae2634487a33181bb44d1508b19a4507c
directory badge
swh:1:dir:83d80ecaf3ffe2b50dfbe0365d52d7add12e01b8
content badge
swh:1:cnt:d62df7f2254ad6df2ed9b954d8e2e717bc12bc1d

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • revision
  • directory
  • content
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
Generate software citation in BibTex format (requires biblatex-software package)
Generating citation ...
tutorial_04.docu
/** \page tutorial_04 Using STL algorithms

Since the %OpenMesh iterators are (almost) conformant to STL iterators,
one can apply the STL algorithms on meshes. The following example
shows how to use the STL \c for_each construct, since it is
easier to read and may be more efficient than hand-written loops.

We will define a class which provides the smoothing algorithm, hence
define a reusable component. The class must be template class because there
is no such thing as a class %OpenMesh, but many different types of %OpenMesh:

\dontinclude 04-stl_algorithms/smooth_algo.hh 
\skipline template

The class SmootherT has two functors, one that computes the barycenter
for a given vertex, and a second that sets the vertex position to the
corresponding barycenter. A functor is simply a class with a function
<tt>operator()(...)</tt>. The first functor \c ComputeCOG
computes the barycenter and stores it in a custom vertex property \c
cog_:

\skipline operator
\until }
\until }

Note, that \c ComputeCOG needs to have access to the mesh object and
the property handle. Here, both are references to member variables of
the smoother object.

The second functor \c class \c SetCOG, which sets the vertex position,
is constructed analogical.

Using these functors and <tt>std::for_each</tt> from the STL
the smoothing algorithm can be realized in a member function of 
\c SmootherT:

\dontinclude 04-stl_algorithms/smooth_algo.hh 
\skipline void smooth
\until }
\until }

<br>The complete example looks like this:

\include 04-stl_algorithms/smooth_algo.hh

<br>and 

\include 04-stl_algorithms/smooth.cc

*/
The diff you're trying to view is too large. Only the first 1000 changed files have been loaded.
Showing with 0 additions and 0 deletions (0 / 0 diffs computed)
swh spinner

Computing file changes ...

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API