OpenMesh: OpenMesh::TriMeshT< Kernel > Class Template Reference

| OpenMesh

Public Types | Public Member Functions | Static Public Member Functions | List of all members
OpenMesh::TriMeshT< Kernel > Class Template Reference

Base type for a triangle mesh. More...

`#include <OpenMesh/Mesh/TriMeshT.hh>`

Inheritance diagram for OpenMesh::TriMeshT< Kernel >:
[legend]
Collaboration diagram for OpenMesh::TriMeshT< Kernel >:
[legend]

## Public Types
enum | { IsPolyMesh = 0 }
enum | { IsTriMesh = 1 }
typedef TriMeshT< Kernel > | This
typedef PolyMeshT< Kernel > | PolyMesh
using | ConnectivityTag = TriConnectivityTag
typedef PolyMesh::Scalar | Scalar
typedef PolyMesh::Point | Point
typedef PolyMesh::Normal | Normal
typedef PolyMesh::Color | Color
typedef PolyMesh::TexCoord1D | TexCoord1D
typedef PolyMesh::TexCoord2D | TexCoord2D
typedef PolyMesh::TexCoord3D | TexCoord3D
typedef PolyMesh::Vertex | Vertex
typedef PolyMesh::Halfedge | Halfedge
typedef PolyMesh::Edge | Edge
typedef PolyMesh::Face | Face
typedef PolyMesh::VertexHandle | VertexHandle
typedef PolyMesh::HalfedgeHandle | HalfedgeHandle
typedef PolyMesh::EdgeHandle | EdgeHandle
typedef PolyMesh::FaceHandle | FaceHandle
typedef PolyMesh::VertexIter | VertexIter
typedef PolyMesh::ConstVertexIter | ConstVertexIter
typedef PolyMesh::EdgeIter | EdgeIter
typedef PolyMesh::ConstEdgeIter | ConstEdgeIter
typedef PolyMesh::FaceIter | FaceIter
typedef PolyMesh::ConstFaceIter | ConstFaceIter
typedef PolyMesh::VertexVertexIter | VertexVertexIter
typedef PolyMesh::VertexOHalfedgeIter | VertexOHalfedgeIter
typedef PolyMesh::VertexIHalfedgeIter | VertexIHalfedgeIter
typedef PolyMesh::VertexEdgeIter | VertexEdgeIter
typedef PolyMesh::VertexFaceIter | VertexFaceIter
typedef PolyMesh::FaceVertexIter | FaceVertexIter
typedef PolyMesh::FaceHalfedgeIter | FaceHalfedgeIter
typedef PolyMesh::FaceEdgeIter | FaceEdgeIter
typedef PolyMesh::FaceFaceIter | FaceFaceIter
typedef PolyMesh::ConstVertexVertexIter | ConstVertexVertexIter
typedef PolyMesh::ConstVertexOHalfedgeIter | ConstVertexOHalfedgeIter
typedef PolyMesh::ConstVertexIHalfedgeIter | ConstVertexIHalfedgeIter
typedef PolyMesh::ConstVertexEdgeIter | ConstVertexEdgeIter
typedef PolyMesh::ConstVertexFaceIter | ConstVertexFaceIter
typedef PolyMesh::ConstFaceVertexIter | ConstFaceVertexIter
typedef PolyMesh::ConstFaceHalfedgeIter | ConstFaceHalfedgeIter
typedef PolyMesh::ConstFaceEdgeIter | ConstFaceEdgeIter
typedef PolyMesh::ConstFaceFaceIter | ConstFaceFaceIter
Public Types inherited from OpenMesh::PolyMeshT< Kernel >
enum | { IsPolyMesh = 1 }
enum | { IsTriMesh = 0 }
typedef PolyMeshT< Kernel > | This
| Self type. Used to specify iterators/circulators.
using | ConnectivityTag = PolyConnectivityTag
typedef Kernel::Scalar | Scalar
| Scalar type.
typedef Kernel::Point | Point
| Coordinate type.
typedef Kernel::Normal | Normal
| Normal type.
typedef Kernel::Color | Color
| Color type.
typedef Kernel::TexCoord1D | TexCoord1D
| TexCoord1D type.
typedef Kernel::TexCoord2D | TexCoord2D
| TexCoord2D type.
typedef Kernel::TexCoord3D | TexCoord3D
| TexCoord3D type.
typedef Kernel::Vertex | Vertex
| Vertex type.
typedef Kernel::Halfedge | Halfedge
| Halfedge type.
typedef Kernel::Edge | Edge
| Edge type.
typedef Kernel::Face | Face
| Face type.
typedef Kernel::VertexHandle | VertexHandle
| Handle for referencing the corresponding item.
typedef Kernel::HalfedgeHandle | HalfedgeHandle
| Scalar type.
typedef Kernel::EdgeHandle | EdgeHandle
| Scalar type.
typedef Kernel::FaceHandle | FaceHandle
| Scalar type.
typedef Kernel::VertexIter | VertexIter
| Scalar type.
typedef Kernel::HalfedgeIter | HalfedgeIter
| Scalar type.
typedef Kernel::EdgeIter | EdgeIter
| Scalar type.
typedef Kernel::FaceIter | FaceIter
| Scalar type.
typedef Kernel::ConstVertexIter | ConstVertexIter
| Scalar type.
typedef Kernel::ConstHalfedgeIter | ConstHalfedgeIter
| Scalar type.
typedef Kernel::ConstEdgeIter | ConstEdgeIter
| Scalar type.
typedef Kernel::ConstFaceIter | ConstFaceIter
| Scalar type.
typedef Kernel::VertexVertexIter | VertexVertexIter
| Circulator.
typedef Kernel::VertexOHalfedgeIter | VertexOHalfedgeIter
| Circulator.
typedef Kernel::VertexIHalfedgeIter | VertexIHalfedgeIter
| Circulator.
typedef Kernel::VertexEdgeIter | VertexEdgeIter
| Circulator.
typedef Kernel::VertexFaceIter | VertexFaceIter
| Circulator.
typedef Kernel::FaceVertexIter | FaceVertexIter
| Circulator.
typedef Kernel::FaceHalfedgeIter | FaceHalfedgeIter
| Circulator.
typedef Kernel::FaceEdgeIter | FaceEdgeIter
| Circulator.
typedef Kernel::FaceFaceIter | FaceFaceIter
| Circulator.
typedef Kernel::ConstVertexVertexIter | ConstVertexVertexIter
| Circulator.
typedef Kernel::ConstVertexOHalfedgeIter | ConstVertexOHalfedgeIter
| Circulator.
typedef Kernel::ConstVertexIHalfedgeIter | ConstVertexIHalfedgeIter
| Circulator.
typedef Kernel::ConstVertexEdgeIter | ConstVertexEdgeIter
| Circulator.
typedef Kernel::ConstVertexFaceIter | ConstVertexFaceIter
| Circulator.
typedef Kernel::ConstFaceVertexIter | ConstFaceVertexIter
| Circulator.
typedef Kernel::ConstFaceHalfedgeIter | ConstFaceHalfedgeIter
| Circulator.
typedef Kernel::ConstFaceEdgeIter | ConstFaceEdgeIter
| Circulator.
typedef Kernel::ConstFaceFaceIter | ConstFaceFaceIter
| Circulator.

## Public Member Functions
| TriMeshT ()
| Default constructor.
| TriMeshT (PolyMesh rhs)
virtual | ~TriMeshT ()
| Destructor.
HalfedgeHandle | vertex_split (Point _v0_point, VertexHandle _v1, VertexHandle _vl, VertexHandle _vr)
| Vertex Split: inverse operation to collapse(). More...
HalfedgeHandle | vertex_split (VertexHandle _v0, VertexHandle _v1, VertexHandle _vl, VertexHandle _vr)
| Vertex Split: inverse operation to collapse(). More...
SmartVertexHandle | split (EdgeHandle _eh, const Point &_p)
| Edge split (= 2-to-4 split) More...
SmartVertexHandle | split_copy (EdgeHandle _eh, const Point &_p)
| Edge split (= 2-to-4 split) More...
void | split (EdgeHandle _eh, VertexHandle _vh)
| Edge split (= 2-to-4 split) More...
void | split_copy (EdgeHandle _eh, VertexHandle _vh)
| Edge split (= 2-to-4 split) More...
SmartVertexHandle | split (FaceHandle _fh, const Point &_p)
| Face split (= 1-to-3 split, calls corresponding PolyMeshT function). More...
SmartVertexHandle | split_copy (FaceHandle _fh, const Point &_p)
| Face split (= 1-to-3 split, calls corresponding PolyMeshT function). More...
void | split (FaceHandle _fh)
| Face split (= 1-to-4) split, splits edges at midpoints and adds 4 new faces in the interior). More...
void | split (FaceHandle _fh, VertexHandle _vh)
| Face split (= 1-to-3 split, calls corresponding PolyMeshT function). More...
void | split_copy (FaceHandle _fh, VertexHandle _vh)
| Face split (= 1-to-3 split, calls corresponding PolyMeshT function). More...
Scalar | calc_face_area (FaceHandle _fh) const
| Calculates the area of a face. More...
Normal vector computation
Normal | calc_face_normal (FaceHandle _fh) const
| Calculate normal vector for face _fh (specialized for TriMesh).
Public Member Functions inherited from OpenMesh::PolyMeshT< Kernel >
| PolyMeshT ()
| Circulator.
template<typename T >
| PolyMeshT (const T &t)
| Circulator.
virtual | ~PolyMeshT ()
| Circulator.
SmartVertexHandle | new_vertex ()
| Uses default copy and assignment operator. More...
SmartVertexHandle | new_vertex (const Point &_p)
| Adds a new vertex initialized to a custom position. More...
SmartVertexHandle | new_vertex_dirty (const Point &_p)
| Same as new_vertex(const Point&) but never shrinks, only enlarges the vertex property vectors. More...
SmartVertexHandle | add_vertex (const Point &_p)
| Alias for new_vertex(const Point&). More...
SmartVertexHandle | add_vertex_dirty (const Point &_p)
| Alias for new_vertex_dirty().
void | update_normals ()
| Compute normals for all primitives. More...
void | update_normal (FaceHandle _fh)
| Update normal for face _fh.
void | update_face_normals ()
| Update normal vectors for all faces. More...
Normal | calc_face_normal (const Point &_p0, const Point &_p1, const Point &_p2) const
| Calculate normal vector for face (_p0, _p1, _p2).
Normal | calc_normal (FaceHandle _fh) const
| same as calc_face_normal
void | calc_face_centroid (FaceHandle _fh, Point &_pt) const
| calculates the average of the vertices defining _fh
Point | calc_face_centroid (FaceHandle _fh) const
| Computes and returns the average of the vertices defining _fh.
Point | calc_centroid (FaceHandle _fh) const
| Computes and returns the average of the vertices defining _fh (same as calc_face_centroid)
Point | calc_centroid (EdgeHandle _eh) const
| Computes and returns the average of the vertices defining _eh (same as calc_edge_midpoint)
Point | calc_centroid (HalfedgeHandle _heh) const
| Computes and returns the average of the vertices defining _heh (same as calc_edge_midpoint for edge of halfedge)
Point | calc_centroid (VertexHandle _vh) const
| Returns the point of _vh.
Point | calc_centroid (MeshHandle _mh) const
| Computes and returns the average of the vertices defining the mesh.
void | update_normal (HalfedgeHandle _heh, const double _feature_angle=0.8)
| Update normal for halfedge _heh.
void | update_halfedge_normals (const double _feature_angle=0.8)
| Update normal vectors for all halfedges. More...
virtual Normal | calc_halfedge_normal (HalfedgeHandle _heh, const double _feature_angle=0.8) const
| Calculate halfedge normal for one specific halfedge. More...
Normal | calc_normal (HalfedgeHandle, const double _feature_angle=0.8) const
| same as calc_halfedge_normal
bool | is_estimated_feature_edge (HalfedgeHandle _heh, const double _feature_angle) const
| identifies feature edges w.r.t. More...
void | update_normal (VertexHandle _vh)
| Update normal for vertex _vh.
void | update_vertex_normals ()
| Update normal vectors for all vertices. More...
Normal | calc_vertex_normal (VertexHandle _vh) const
| Calculate vertex normal for one specific vertex. More...
void | calc_vertex_normal_fast (VertexHandle _vh, Normal &_n) const
| Different methods for calculation of the normal at _vh: More...
void | calc_vertex_normal_correct (VertexHandle _vh, Normal &_n) const
| Compute normals for all primitives. More...
void | calc_vertex_normal_loop (VertexHandle _vh, Normal &_n) const
| Compute normals for all primitives. More...
Normal | calc_normal (VertexHandle _vh) const
| same as calc_vertex_normal_correct
void | calc_edge_vector (EdgeHandle _eh, Normal &_edge_vec) const
| Calculates the edge vector as the vector defined by the halfedge with id #0 (see below)
Normal | calc_edge_vector (EdgeHandle _eh) const
| Calculates the edge vector as the vector defined by the halfedge with id #0 (see below)
void | calc_edge_vector (HalfedgeHandle _heh, Normal &_edge_vec) const
| Calculates the edge vector as the difference of the the points defined by to_vertex_handle() and from_vertex_handle()
Normal | calc_edge_vector (HalfedgeHandle _heh) const
| Calculates the edge vector as the difference of the the points defined by to_vertex_handle() and from_vertex_handle()
Scalar | calc_edge_length (EdgeHandle _eh) const
| Compute normals for all primitives. More...
Scalar | calc_edge_length (HalfedgeHandle _heh) const
| Calculates the length of the edge _heh.
Scalar | calc_edge_sqr_length (EdgeHandle _eh) const
| Compute normals for all primitives. More...
Scalar | calc_edge_sqr_length (HalfedgeHandle _heh) const
| Compute normals for all primitives. More...
Point | calc_edge_midpoint (HalfedgeHandle _heh) const
| Calculates the midpoint of the halfedge _heh, defined by the positions of the two incident vertices.
Point | calc_edge_midpoint (EdgeHandle _eh) const
| Calculates the midpoint of the edge _eh, defined by the positions of the two incident vertices.
Normal | calc_normal (EdgeHandle _eh) const
| calculated and returns the average of the two vertex normals
void | calc_sector_vectors (HalfedgeHandle _in_heh, Normal &_vec0, Normal &_vec1) const
| defines a consistent representation of a sector geometry: the halfedge _in_heh defines the sector orientation the vertex pointed by _in_heh defines the sector center _vec0 and _vec1 are resp. More...
Scalar | calc_sector_angle (HalfedgeHandle _in_heh) const
| calculates the sector angle. More...
void | calc_sector_normal (HalfedgeHandle _in_heh, Normal &_sector_normal) const
| calculates the normal (non-normalized) of the face sector defined by the angle <(_in_heh,next_halfedge(_in_heh))
Scalar | calc_sector_area (HalfedgeHandle _in_heh) const
| calculates the area of the face sector defined by the angle <(_in_heh,next_halfedge(_in_heh)) NOTE: special cases (e.g. More...
Scalar | calc_dihedral_angle_fast (HalfedgeHandle _heh) const
| calculates the dihedral angle on the halfedge _heh More...
Scalar | calc_dihedral_angle_fast (EdgeHandle _eh) const
| calculates the dihedral angle on the edge _eh More...
Scalar | calc_dihedral_angle (HalfedgeHandle _heh) const
| Compute normals for all primitives. More...
Scalar | calc_dihedral_angle (EdgeHandle _eh) const
| Compute normals for all primitives. More...
unsigned int | find_feature_edges (Scalar _angle_tresh=OpenMesh::deg_to_rad(44.0))
| tags an edge as a feature if its dihedral angle is larger than _angle_tresh returns the number of the found feature edges, requires edge_status property
void | split (FaceHandle _fh, const Point &_p)
| Face split (= 1-to-n split)
void | split (FaceHandle _fh, VertexHandle _vh)
| Compute normals for all primitives. More...
void | split (EdgeHandle _eh, const Point &_p)
| Compute normals for all primitives. More...
void | split (EdgeHandle _eh, VertexHandle _vh)
| Compute normals for all primitives. More...

## Static Public Member Functions
static constexpr bool | is_polymesh ()
| Determine whether this is a PolyMeshT or TriMeshT (This function does not check the per face vertex count! It only checks if the datatype is PolyMeshT or TriMeshT)
static constexpr bool | is_trimesh ()
Static Public Member Functions inherited from OpenMesh::PolyMeshT< Kernel >
static constexpr bool | is_polymesh ()
| Determine whether this is a PolyMeshT or TriMeshT (This function does not check the per face vertex count! It only checks if the datatype is PolyMeshT or TriMeshT)
static constexpr bool | is_trimesh ()

## Detailed Description

### template<class Kernel>
class OpenMesh::TriMeshT< Kernel >

Base type for a triangle mesh.

Base type for a triangle mesh, parameterized by a mesh kernel. The mesh inherits all methods from the kernel class and the more general polygonal mesh PolyMeshT. Therefore it provides the same types for items, handles, iterators and so on.

Parameters

  Kernel | template argument for the mesh kernel

Note
  You should use the predefined mesh-kernel combinations in Predefined Mesh Types

See also
  Specifying your MyMesh
  OpenMesh::PolyMeshT

## Member Function Documentation

## ◆ calc_face_area()

template<class Kernel >

Scalar OpenMesh::TriMeshT< Kernel >::calc_face_area | ( | FaceHandle | _fh | ) | const
| inline

Calculates the area of a face.

Parameters

  _fh | Handle of the face to calculate the area of

## ◆ split() [1/5]

template<class Kernel >

SmartVertexHandle OpenMesh::TriMeshT< Kernel >::split | ( | EdgeHandle | _eh,
|  | const Point & | _p
| ) |  |
| inline

Edge split (= 2-to-4 split)

The properties of the new edges will be undefined!

Parameters

  _eh | Edge handle that should be splitted
  _p | New point position that will be inserted at the edge

Returns
  Vertex handle of the newly added vertex

## ◆ split() [2/5]

template<class Kernel >

void OpenMesh::TriMeshT< Kernel >::split | ( | EdgeHandle | _eh,
|  | VertexHandle | _vh
| ) |  |
| inline

Edge split (= 2-to-4 split)

The properties of the new edges will be undefined!

Parameters

  _eh | Edge handle that should be splitted
  _vh | Vertex handle that will be inserted at the edge

## ◆ split() [3/5]

template<class Kernel >

void OpenMesh::TriMeshT< Kernel >::split | ( | FaceHandle | _fh | ) |
| inline

Face split (= 1-to-4) split, splits edges at midpoints and adds 4 new faces in the interior).

Parameters

  _fh | Face handle that should be splitted

## ◆ split() [4/5]

template<class Kernel >

SmartVertexHandle OpenMesh::TriMeshT< Kernel >::split | ( | FaceHandle | _fh,
|  | const Point & | _p
| ) |  |
| inline

Face split (= 1-to-3 split, calls corresponding PolyMeshT function).

The properties of the new faces will be undefined!

Parameters

  _fh | Face handle that should be splitted
  _p | New point position that will be inserted in the face

Returns
  Vertex handle of the new vertex

## ◆ split() [5/5]

template<class Kernel >

void OpenMesh::TriMeshT< Kernel >::split | ( | FaceHandle | _fh,
|  | VertexHandle | _vh
| ) |  |
| inline

Face split (= 1-to-3 split, calls corresponding PolyMeshT function).

The properties of the new faces will be undefined!

Parameters

  _fh | Face handle that should be splitted
  _vh | Vertex handle that will be inserted at the face

## ◆ split_copy() [1/4]

template<class Kernel >

SmartVertexHandle OpenMesh::TriMeshT< Kernel >::split_copy | ( | EdgeHandle | _eh,
|  | const Point & | _p
| ) |  |
| inline

Edge split (= 2-to-4 split)

The properties of the new edges will be adjusted to the properties of the original edge

Parameters

  _eh | Edge handle that should be splitted
  _p | New point position that will be inserted at the edge

Returns
  Vertex handle of the newly added vertex

## ◆ split_copy() [2/4]

template<class Kernel >

void OpenMesh::TriMeshT< Kernel >::split_copy | ( | EdgeHandle | _eh,
|  | VertexHandle | _vh
| ) |  |
| inline

Edge split (= 2-to-4 split)

The properties of the new edges will be adjusted to the properties of the original edge

Parameters

  _eh | Edge handle that should be splitted
  _vh | Vertex handle that will be inserted at the edge

## ◆ split_copy() [3/4]

template<class Kernel >

SmartVertexHandle OpenMesh::TriMeshT< Kernel >::split_copy | ( | FaceHandle | _fh,
|  | const Point & | _p
| ) |  |
| inline

Face split (= 1-to-3 split, calls corresponding PolyMeshT function).

The properties of the new faces will be adjusted to the properties of the original face

Parameters

  _fh | Face handle that should be splitted
  _p | New point position that will be inserted in the face

Returns
  Vertex handle of the new vertex

## ◆ split_copy() [4/4]

template<class Kernel >

void OpenMesh::TriMeshT< Kernel >::split_copy | ( | FaceHandle | _fh,
|  | VertexHandle | _vh
| ) |  |
| inline

Face split (= 1-to-3 split, calls corresponding PolyMeshT function).

The properties of the new faces will be adjusted to the properties of the original face

Parameters

  _fh | Face handle that should be splitted
  _vh | Vertex handle that will be inserted at the face

## ◆ vertex_split() [1/2]

template<class Kernel >

HalfedgeHandle OpenMesh::TriMeshT< Kernel >::vertex_split | ( | Point | _v0_point,
|  | VertexHandle | _v1,
|  | VertexHandle | _vl,
|  | VertexHandle | _vr
| ) |  |
| inline

Vertex Split: inverse operation to collapse().

Insert the new vertex at position v0. The vertex will be added as the inverse of the edge collapse. The faces above the split will be correctly attached to the two new edges

    Before:
    v_l     v0     v_r
     x      x      x
      \           /
       \         /
        \       /
         \     /
          \   /
           \ /
            x
            v1

    After:
    v_l    v0      v_r
     x------x------x
      \     |     /
       \    |    /
        \   |   /
         \  |  /
          \ | /
           |/
            x
            v1

Parameters

  _v0_point | Point position for the new point
  _v1 | Vertex that will be split
  _vl | Left vertex handle
  _vr | Right vertex handle

Returns
  Newly inserted halfedge

## ◆ vertex_split() [2/2]

template<class Kernel >

HalfedgeHandle OpenMesh::TriMeshT< Kernel >::vertex_split | ( | VertexHandle | _v0,
|  | VertexHandle | _v1,
|  | VertexHandle | _vl,
|  | VertexHandle | _vr
| ) |  |
| inline

Vertex Split: inverse operation to collapse().

Insert the new vertex at position v0. The vertex will be added as the inverse of the edge collapse. The faces above the split will be correctly attached to the two new edges

    Before:
    v_l     v0     v_r
     x      x      x
      \           /
       \         /
        \       /
         \     /
          \   /
           \ /
            x
            v1

    After:
    v_l    v0      v_r
     x------x------x
      \     |     /
       \    |    /
        \   |   /
         \  |  /
          \ | /
           |/
            x
            v1

Parameters

  _v0 | Vertex handle for the newly inserted point (Input has to be unconnected!)
  _v1 | Vertex that will be split
  _vl | Left vertex handle
  _vr | Right vertex handle

Returns
  Newly inserted halfedge

The documentation for this class was generated from the following files:

- OpenMesh/Core/Mesh/TriMeshT.hh
- OpenMesh/Core/Mesh/TriMeshT_impl.hh