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_02.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:a117c38cd758a7b3ddc9df32c5d893881a2fc03b

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_02.docu
/** \page tutorial_02 Using iterators and circulators

This examples shows:

- How to use iterators,
- How to use circulators.

This example is the first version of the simple mesh smoother. Here we
will introduce \em iterators and \em circulators. These two concepts
provide functionality to linearly enumerate e.g. all vertices of a
mesh, and to circulate around a vertex, i.e. to enumerate all its
one-ring neighbors. For a more detailed description, see \ref
mesh_iterators.

First we have to define the mesh type we want to use. This time we use
a triangle mesh instead of a polygonal mesh:

\dontinclude 02-iterators/smooth.cc
\skipline TriMesh_ArrayKernel
\skipline MyMesh

<br>We read the mesh to be smoothed from a file:

\skipline read_mesh

<br>One smoothing iteration is done in two steps: 
<ol>
<li>For each vertex: calculate the barycenter of its one-ring neighbors.</li>
<li>For each vertex: move the vertex to the computed barycenter.</li>
</ol>

This can easily be implemented using vertex iterators. The mesh
provides begin and end iterators by <tt>vertices_begin()</tt> and
<tt>vertices_end()</tt>.

\skipline VertexIter
\skipline v_it!=v_end

<br>For calculating the barycenter, we have to iterate through the
one-ring neighborhood of the current vertex. This functionality 
is provided by the <tt>VertexVertexIter</tt>:

\dontinclude 02-iterators/smooth.cc
\skipline VertexVertexIter
\skipline vv_it=

<br>Now we can calculate the barycenters for each vertex and store them in
the array <tt>cogs</tt>:

\dontinclude 02-iterators/smooth.cc
\skipline std::vector
\skipline v_it=
\until cogs.push_back
\until }

<br>After we have calculated the barycenters all that is left to do is to
move the vertices to the corresponding barycenters. The complete source
code is listed below.

\include 02-iterators/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