44 #ifndef OPENMESH_MESH_ITEMS_HH
45 #define OPENMESH_MESH_ITEMS_HH
51 #include <OpenMesh/Core/System/config.h>
52 #include <OpenMesh/Core/Utils/GenProg.hh>
53 #include <OpenMesh/Core/Utils/vector_traits.hh>
54 #include <OpenMesh/Core/Mesh/Handles.hh>
66 template <
class Traits,
bool IsTriMesh>
70 #ifndef DOXY_IGNORE_THIS
73 typedef typename Traits::Point Point;
89 typedef typename Refs::Point Point;
90 typedef typename Refs::Scalar Scalar;
122 typedef typename Traits::template VertexT<ITraits, Refs> VertexData;
123 typedef typename Traits::template HalfedgeT<ITraits, Refs> HalfedgeData;
124 typedef typename Traits::template EdgeT<ITraits, Refs> EdgeData;
125 typedef typename Traits::template FaceT<ITraits, Refs> FaceData;
129 #ifndef DOXY_IGNORE_THIS
132 template<
typename Lhs,
typename Rhs>
struct TypeEquality;
133 template<
typename Lhs>
struct TypeEquality<Lhs, Lhs> {};
135 template<
typename LhsTraits,
typename RhsTraits>
struct ItemsEquality {
136 TypeEquality<typename LhsTraits::Point, typename RhsTraits::Point> te1;
137 TypeEquality<typename LhsTraits::Scalar, typename RhsTraits::Scalar> te2;
138 TypeEquality<typename LhsTraits::Normal, typename RhsTraits::Normal> te3;
139 TypeEquality<typename LhsTraits::Color, typename RhsTraits::Color> te4;
140 TypeEquality<typename LhsTraits::TexCoord1D, typename RhsTraits::TexCoord1D> te5;
141 TypeEquality<typename LhsTraits::TexCoord2D, typename RhsTraits::TexCoord2D> te6;
142 TypeEquality<typename LhsTraits::TexCoord3D, typename RhsTraits::TexCoord3D> te7;
143 TypeEquality<typename LhsTraits::TextureIndex, typename RhsTraits::TextureIndex> te8;
178 template<
typename LhsMeshT,
typename RhsMeshT>
struct MeshCast;
180 template<
typename LhsMeshT,
typename RhsMeshT>
182 static LhsMeshT &cast(RhsMeshT &rhs) {
183 (void)
sizeof(TM::ItemsEquality<typename LhsMeshT::MeshItemsT, typename RhsMeshT::MeshItemsT>);
184 (void)
sizeof(TM::TypeEquality<typename LhsMeshT::ConnectivityT, typename RhsMeshT::ConnectivityT>);
185 return reinterpret_cast<LhsMeshT&
>(rhs);
189 template<
typename LhsMeshT,
typename RhsMeshT>
190 struct MeshCast<const LhsMeshT&,
const RhsMeshT&> {
191 static const LhsMeshT &cast(
const RhsMeshT &rhs) {
192 (void)
sizeof(TM::ItemsEquality<typename LhsMeshT::MeshItemsT, typename RhsMeshT::MeshItemsT>);
193 (void)
sizeof(TM::TypeEquality<typename LhsMeshT::ConnectivityT, typename RhsMeshT::ConnectivityT>);
194 return reinterpret_cast<const LhsMeshT&
>(rhs);
198 template<
typename LhsMeshT,
typename RhsMeshT>
200 static LhsMeshT *cast(RhsMeshT *rhs) {
201 (void)
sizeof(TM::ItemsEquality<typename LhsMeshT::MeshItemsT, typename RhsMeshT::MeshItemsT>);
202 (void)
sizeof(TM::TypeEquality<typename LhsMeshT::ConnectivityT, typename RhsMeshT::ConnectivityT>);
203 return reinterpret_cast<LhsMeshT*
>(rhs);
207 template<
typename LhsMeshT,
typename RhsMeshT>
208 struct MeshCast<const LhsMeshT*,
const RhsMeshT*> {
209 static const LhsMeshT *cast(
const RhsMeshT *rhs) {
210 (void)
sizeof(TM::ItemsEquality<typename LhsMeshT::MeshItemsT, typename RhsMeshT::MeshItemsT>);
211 (void)
sizeof(TM::TypeEquality<typename LhsMeshT::ConnectivityT, typename RhsMeshT::ConnectivityT>);
212 return reinterpret_cast<const LhsMeshT*
>(rhs);
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
@ TextureIndex
Add texture index (faces)
Definition: Attributes.hh:89
@ Normal
Add normals to mesh item (vertices/faces)
Definition: Attributes.hh:82
@ TexCoord2D
Add 2D texture coordinates (vertices, halfedges)
Definition: Attributes.hh:87
@ TexCoord1D
Add 1D texture coordinates (vertices, halfedges)
Definition: Attributes.hh:86
@ TexCoord3D
Add 3D texture coordinates (vertices, halfedges)
Definition: Attributes.hh:88
@ Color
Add colors to mesh item (vertices/faces/edges)
Definition: Attributes.hh:83
Definition of the mesh entities (items).
Definition: FinalMeshItemsT.hh:68
Definition: FinalMeshItemsT.hh:120
Cast a mesh with different but identical traits into each other.
Definition: FinalMeshItemsT.hh:178
Handle for a vertex entity.
Definition: Handles.hh:121
Handle for a halfedge entity.
Definition: Handles.hh:128
Handle for a edge entity.
Definition: Handles.hh:135
Handle for a face entity.
Definition: Handles.hh:142
Helper class providing information about a vector type.
Definition: vector_traits.hh:89
#define VertexAttributes(_i)
Macro for defining the vertex attributes. See Specifying your MyMesh.
Definition: Traits.hh:79
#define HalfedgeAttributes(_i)
Macro for defining the halfedge attributes. See Specifying your MyMesh.
Definition: Traits.hh:82
#define FaceAttributes(_i)
Macro for defining the face attributes. See Specifying your MyMesh.
Definition: Traits.hh:88
#define EdgeAttributes(_i)
Macro for defining the edge attributes. See Specifying your MyMesh.
Definition: Traits.hh:85