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_07.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:cda8a75277d4dac8a9e5f007f94e98923259f0df

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_07.docu
/** \page tutorial_07 Extending the mesh using traits

This examples shows:

- How to extend the behaviour of entities using traits.

In the previous tutorial we used attributes and changed the type of
the data types \c Point, \c Normal, \c TexCoord, and \c Color. But we
can do even more with traits. We can change the behaviour of the mesh
entities \c Vertex, \c Face, \c Edge, and \c Halfedge. 

One goal in the design was a highly customizable data structure. Using
the traits technique makes it possible. We pick up the smoother again
and show an alternative way to implement it. Now we place the necessary
data and the functions in the vertex itself

\dontinclude 07-traits/smooth.cc
\skipline MyTraits
\until };

Note the definition of the vertex entity. We use the supplied define
\c VertexTraits (which resolves in a rather inconvenient template
definition). Similary we can use the defines \c FaceTraits, \c
EdgeTraits, and \c HalfedgeTraits to extend these entities. Now we
enhanced the vertex, with the additional member variable \c cog_, and
the get/set-method pair to access the new member.

As before we compute in a first loop the barycenters for all vertices
and store the information at the vertices

\skipline mesh.data(*v_it).set_cog

In the second pass we set the new position of each vertex

\skipline mesh.data(*v_it).cog

It looks neat, but on the other hand we can't remove the data anymore
as we could do with properties!  By using traits one creates a 'static'
configuration, which can't be changed during runtime.

The complete source looks like this:

\include 07-traits/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