49 #ifndef OPENMESH_MESH_ITEMS_HH
50 #define OPENMESH_MESH_ITEMS_HH
56 #include <OpenMesh/Core/System/config.h>
57 #include <OpenMesh/Core/Utils/GenProg.hh>
58 #include <OpenMesh/Core/Utils/vector_traits.hh>
59 #include <OpenMesh/Core/Mesh/Handles.hh>
71 template <
class Traits,
bool IsTriMesh>
75 #ifndef DOXY_IGNORE_THIS
78 typedef typename Traits::Point Point;
94 typedef typename Refs::Point Point;
95 typedef typename Refs::Scalar Scalar;
127 typedef typename Traits::template VertexT<ITraits, Refs> VertexData;
128 typedef typename Traits::template HalfedgeT<ITraits, Refs> HalfedgeData;
129 typedef typename Traits::template EdgeT<ITraits, Refs> EdgeData;
130 typedef typename Traits::template FaceT<ITraits, Refs> FaceData;
134 #ifndef DOXY_IGNORE_THIS
137 template<
typename Lhs,
typename Rhs>
struct TypeEquality;
138 template<
typename Lhs>
struct TypeEquality<Lhs, Lhs> {};
140 template<
typename LhsTraits,
typename RhsTraits>
struct ItemsEquality {
141 TypeEquality<typename LhsTraits::Point, typename RhsTraits::Point> te1;
142 TypeEquality<typename LhsTraits::Scalar, typename RhsTraits::Scalar> te2;
143 TypeEquality<typename LhsTraits::Normal, typename RhsTraits::Normal> te3;
144 TypeEquality<typename LhsTraits::Color, typename RhsTraits::Color> te4;
145 TypeEquality<typename LhsTraits::TexCoord1D, typename RhsTraits::TexCoord1D> te5;
146 TypeEquality<typename LhsTraits::TexCoord2D, typename RhsTraits::TexCoord2D> te6;
147 TypeEquality<typename LhsTraits::TexCoord3D, typename RhsTraits::TexCoord3D> te7;
148 TypeEquality<typename LhsTraits::TextureIndex, typename RhsTraits::TextureIndex> te8;
183 template<
typename LhsMeshT,
typename RhsMeshT>
struct MeshCast;
185 template<
typename LhsMeshT,
typename RhsMeshT>
187 static LhsMeshT &cast(RhsMeshT &rhs) {
188 (void)
sizeof(TM::ItemsEquality<typename LhsMeshT::MeshItemsT, typename RhsMeshT::MeshItemsT>);
189 (void)
sizeof(TM::TypeEquality<typename LhsMeshT::ConnectivityT, typename RhsMeshT::ConnectivityT>);
190 return reinterpret_cast<LhsMeshT&
>(rhs);
194 template<
typename LhsMeshT,
typename RhsMeshT>
195 struct MeshCast<const LhsMeshT&,
const RhsMeshT&> {
196 static const LhsMeshT &cast(
const RhsMeshT &rhs) {
197 (void)
sizeof(TM::ItemsEquality<typename LhsMeshT::MeshItemsT, typename RhsMeshT::MeshItemsT>);
198 (void)
sizeof(TM::TypeEquality<typename LhsMeshT::ConnectivityT, typename RhsMeshT::ConnectivityT>);
199 return reinterpret_cast<const LhsMeshT&
>(rhs);
203 template<
typename LhsMeshT,
typename RhsMeshT>
205 static LhsMeshT *cast(RhsMeshT *rhs) {
206 (void)
sizeof(TM::ItemsEquality<typename LhsMeshT::MeshItemsT, typename RhsMeshT::MeshItemsT>);
207 (void)
sizeof(TM::TypeEquality<typename LhsMeshT::ConnectivityT, typename RhsMeshT::ConnectivityT>);
208 return reinterpret_cast<LhsMeshT*
>(rhs);
212 template<
typename LhsMeshT,
typename RhsMeshT>
213 struct MeshCast<const LhsMeshT*,
const RhsMeshT*> {
214 static const LhsMeshT *cast(
const RhsMeshT *rhs) {
215 (void)
sizeof(TM::ItemsEquality<typename LhsMeshT::MeshItemsT, typename RhsMeshT::MeshItemsT>);
216 (void)
sizeof(TM::TypeEquality<typename LhsMeshT::ConnectivityT, typename RhsMeshT::ConnectivityT>);
217 return reinterpret_cast<const LhsMeshT*
>(rhs);
225 #endif // OPENMESH_MESH_ITEMS_HH defined
Add normals to mesh item (vertices/faces)
Definition: Attributes.hh:87
Add colors to mesh item (vertices/faces/edges)
Definition: Attributes.hh:88
Definition of the mesh entities (items).
Definition: FinalMeshItemsT.hh:72
Add 1D texture coordinates (vertices, halfedges)
Definition: Attributes.hh:91
#define EdgeAttributes(_i)
Macro for defining the edge attributes. See Specifying your MyMesh.
Definition: Traits.hh:90
Definition: FinalMeshItemsT.hh:124
#define HalfedgeAttributes(_i)
Macro for defining the halfedge attributes. See Specifying your MyMesh.
Definition: Traits.hh:87
Add 2D texture coordinates (vertices, halfedges)
Definition: Attributes.hh:92
Handle for a vertex entity.
Definition: Handles.hh:123
Helper class providing information about a vector type.
Definition: vector_traits.hh:93
#define FaceAttributes(_i)
Macro for defining the face attributes. See Specifying your MyMesh.
Definition: Traits.hh:93
Handle for a edge entity.
Definition: Handles.hh:137
Cast a mesh with different but identical traits into each other.
Definition: FinalMeshItemsT.hh:183
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
#define VertexAttributes(_i)
Macro for defining the vertex attributes. See Specifying your MyMesh.
Definition: Traits.hh:84
Add 3D texture coordinates (vertices, halfedges)
Definition: Attributes.hh:93
Handle for a halfedge entity.
Definition: Handles.hh:130
Add texture index (faces)
Definition: Attributes.hh:94
Handle for a face entity.
Definition: Handles.hh:144