rtcVertexOctree.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2008
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 .......: VertexOctree.h
00012  * authors ....: Benjamin Pitzer
00013  * organization: Robert Bosch LLC
00014  * creation ...: 07/25/2006
00015  * modified ...: $Date: 2009-08-19 20:09:33 -0700 (Wed, 19 Aug 2009) $
00016  * changed by .: $Author: benjaminpitzer $
00017  * revision ...: $Revision: 890 $
00018  */
00019 #ifndef VERTEXOCTREE_H
00020 #define VERTEXOCTREE_H
00021 
00022 //== INCLUDES ==================================================================
00023 #include <Geometry3D.h>
00024 #include <mesh.h>
00025 #include <vector>
00026 
00027 //== NAMESPACES ================================================================
00028 namespace puma {
00029 
00030 //== CLASS DEFINITION ==========================================================
00031 class VertexOctree
00032 {
00033 public:
00034   VertexOctree(
00035     const TriMesh*           mesh,
00036     unsigned int             maximum_depth,
00037     unsigned int             min_entries
00038     );
00039 
00040   VertexOctree(
00041     const TriMesh*           mesh,
00042     Vec3f                    center,
00043     float                    radius,
00044     unsigned int             maximum_depth,
00045     unsigned int             min_entries);
00046 
00047   VertexOctree(
00048     const TriMesh*           mesh,
00049     Vec3f                    center,
00050     float                    radius,
00051     unsigned int             current_depth,
00052     std::vector<VertexHandle>& vertices,
00053     unsigned int             maximum_depth,
00054     unsigned int             min_entries,
00055     int                      parentIndex = 0,
00056     VertexOctree*            parentTree = NULL);
00057 
00058   ~VertexOctree(void) {};
00059 
00060   bool searchNearest(const Vec3f &p, VertexHandle& vertex, float& distance);
00061   void refineTree();
00062   void getCubes(std::vector<Vec3f> &points, std::vector<int> &edges);
00063   void getCubeCenters(std::vector<Vec3f> &centers);
00064   void getPoints(std::vector<Vec3f> &points);
00065   void getVertices(std::vector<VertexHandle>& vertices);
00066   void getLeaves(std::vector<VertexOctree*>& leafes);
00067 
00068   Vec3f center() { return m_center; }
00069   float radius() { return m_radius; }
00070   bool isLeaf() { return m_isLeaf; }
00071 
00072 
00073 private:
00074   void initialize(std::vector<VertexHandle>& faces);
00075   bool closerToVertex(const Vec3f &p, const VertexHandle& vertex_handle, float& distance);
00076 
00077 private:
00078   const TriMesh*            m_mesh;
00079   Vec3f                     m_center;
00080   float                     m_radius;
00081   int                       m_parentIndex;
00082   VertexOctree*             m_parentTree;
00083   VertexOctree*             m_child[8];
00084   unsigned int              m_current_depth;
00085 
00086   // parameters
00087   unsigned int              m_maximum_depth;
00088   unsigned int              m_min_entries;
00089 
00090   bool                      m_isLeaf;
00091   std::vector<VertexHandle> m_vertices; // vertex indices, groups of three
00092 };
00093 
00094 //==============================================================================
00095 } // NAMESPACE puma
00096 //==============================================================================
00097 #endif // VERTEXOCTREE_H defined
00098 //==============================================================================


rtc
Author(s): Benjamin Pitzer
autogenerated on Mon Oct 6 2014 10:07:35