$search
00001 /* 00002 * Copyright (C) 2007 00003 * Robert Bosch LLC 00004 * Research and Technology Center North America 00005 * Palo Alto, California 00006 * 00007 * All rights reserved. 00008 * 00009 *------------------------------------------------------------------------------ 00010 * project ....: PUMA: Probablistic Unsupervised Model Acquisition 00011 * file .......: mesh.h 00012 * authors ....: Benjamin Pitzer 00013 * organization: Robert Bosch LLC 00014 * creation ...: 8/4/2006 00015 * modified ...: $Date: 2009-08-25 17:32:44 -0700 (Tue, 25 Aug 2009) $ 00016 * changed by .: $Author: benjaminpitzer $ 00017 * revision ...: $Revision: 893 $ 00018 */ 00019 #ifndef MESH_H 00020 #define MESH_H 00021 00022 //== INCLUDES ================================================================== 00023 #include <rtc/rtcVec3.h> 00024 #include <rtc/rtcMesh3D.h> 00025 #include <OpenMesh/Core/IO/MeshIO.hh> 00026 #include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh> 00027 00028 //== NAMESPACES ================================================================ 00029 namespace rtc { 00030 00031 // Define the mesh 00032 struct TriMeshTraits : public OpenMesh::DefaultTraits 00033 { 00034 VertexAttributes (OpenMesh::Attributes::Normal | 00035 OpenMesh::Attributes::Color | 00036 OpenMesh::Attributes::Status); 00037 HalfedgeAttributes (OpenMesh::Attributes::PrevHalfedge); 00038 FaceAttributes (OpenMesh::Attributes::Normal); 00039 }; 00040 typedef OpenMesh::TriMesh_ArrayKernelT<TriMeshTraits> TriMesh; 00041 00042 // face stuff 00043 typedef TriMesh::FaceHandle FaceHandle; 00044 typedef TriMesh::FaceIter FaceIter; 00045 typedef TriMesh::ConstFaceIter ConstFaceIter; 00046 typedef TriMesh::ConstFaceFaceIter ConstFaceFaceIter; 00047 typedef std::vector<FaceHandle> FHandles; 00048 typedef OpenMesh::FPropHandleT<int> FPropInt; 00049 typedef TriMesh::FaceVertexIter FaceVertexIter; 00050 typedef TriMesh::ConstFaceVertexIter ConstFaceVertexIter; 00051 00052 // vertex stuff 00053 typedef TriMesh::VertexHandle VertexHandle; 00054 typedef TriMesh::VertexIter VertexIter; 00055 typedef TriMesh::VertexVertexIter VertexVertexIter; 00056 typedef TriMesh::ConstVertexIter ConstVertexIter; 00057 typedef TriMesh::ConstVertexVertexIter ConstVertexVertexIter; 00058 typedef std::vector<VertexHandle> VHandles; 00059 typedef OpenMesh::VPropHandleT<int> VPropInt; 00060 00061 // edge stuff 00062 typedef TriMesh::EdgeHandle EdgeHandle; 00063 typedef TriMesh::EdgeIter EdgeIter; 00064 typedef TriMesh::ConstEdgeIter ConstEdgeIter; 00065 typedef TriMesh::HalfedgeHandle HalfedgeHandle; 00066 typedef OpenMesh::EPropHandleT<double> EPropDouble; 00067 00068 // other stuff 00069 typedef TriMesh::Point Point; 00070 typedef TriMesh::Color Color; 00071 typedef TriMesh::Normal Normal; 00072 00073 // Handle for a texture entity 00074 struct TextureHandle : public OpenMesh::BaseHandle 00075 { 00076 explicit TextureHandle(int _idx=-1) : BaseHandle(_idx) {} 00077 }; 00078 00079 // helper functions 00080 Vec3f point_to_vec(const Point& p); 00081 Vec3f normal_to_vec(const Normal& p); 00082 Vec3uc color_to_vec(const Color& p); 00083 Point vec_to_point(const Vec3f& v); 00084 Normal vec_to_normal(const Vec3f& v); 00085 Color vec_to_color(const Vec3uc& v); 00086 void convertMeshToTriMesh(const Mesh3D& input, TriMesh& output); 00087 void convertTriMeshToMesh(const TriMesh& input, Mesh3D& output); 00088 00089 //============================================================================== 00090 } // NAMESPACE puma 00091 //============================================================================== 00092 #endif // MESH_H defined 00093 //==============================================================================