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_01.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:99f6ab00ddbbae4d946e39e90d513d7593ba7325

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_01.docu
/** \page tutorial_01 First Steps - Building a cube

This small example shows:
\li How to declare your type \c MyMesh,
\li How to add vertices and faces to a mesh,
\li How to write a mesh using the IO functions.

For each program the first step is to define your type \c
MyMesh. %OpenMesh supports general polygonal meshes (faces are polygons
with varying number of vertices) as well as specialized triangle
meshes (all faces are triangles). In this example we want to build a
cube from six quadrangles, therefore we choose the polygonal mesh.

%OpenMesh also supports different mesh kernels, specifying how all the
vertices, edges, and faces are stored internally (see also \ref
mesh_kernels_group). However, the storage must provide an array like interface.
For the tutorial we use the supplied ArrayKernel. The predefined
combinations of TriMesh/PolyMesh and the kernel are
contained in \c %OpenMesh/src/OpenMesh/Core/Mesh, we use the
<tt>PolyMesh_ArrayKernelT</tt>. 

\dontinclude build_cube.cc
\skipline PolyMesh_ArrayKernel
\skipline MyMesh

Now since we have declared our type \c MyMesh, we only have to add 8
vertices and 6 quadrangles to build a cube. Adding a vertex is done
using the <tt>add_vertex</tt> method. It gets a coordinate and returns
a handle to the inserted vertex. We store all handles in an array,
since we need them for specifying the faces.

\skipline vhandle[0]
\until vhandle[3]

<br>In order to add a face to the mesh, we have to build a vector holding
the handles to the face's vertices. This vector is passed to the
\c add_face method. The following block will create a face from the first
four vertices:

\skipline face_vhandles
\until add_face

<br>The orientation of the face is defined by the order in which the
vertices are given: If you look at the frontfacing side of the
polygon, then the vertices are in counter-clockwise order.

After creating all of the six faces, we want to write the resulting
mesh to standard output. %OpenMesh provides some basic input/output 
methods in the namespace OpenMesh::IO:

\skipline write_

<br>To use the IO facility of %OpenMesh make sure that the include MeshIO.hh is
included first.

\dontinclude build_cube.cc
\skipline MeshIO
\until PolyMesh_ArrayKernel

<br>The complete source looks like this:

\include build_cube.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