Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

VHierarchyNode.hh

00001 /*===========================================================================*\
00002  *                                                                           *
00003  *                               OpenMesh                                    *
00004  *      Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen      *
00005  *                           www.openmesh.org                                *
00006  *                                                                           *
00007  *---------------------------------------------------------------------------* 
00008  *                                                                           *
00009  *                                License                                    *
00010  *                                                                           *
00011  *  This library is free software; you can redistribute it and/or modify it  *
00012  *  under the terms of the GNU Library General Public License as published   *
00013  *  by the Free Software Foundation, version 2.                              *
00014  *                                                                           *
00015  *  This library is distributed in the hope that it will be useful, but      *
00016  *  WITHOUT ANY WARRANTY; without even the implied warranty of               *
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        *
00018  *  Library General Public License for more details.                         *
00019  *                                                                           *
00020  *  You should have received a copy of the GNU Library General Public        *
00021  *  License along with this library; if not, write to the Free Software      *
00022  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                *
00023  *                                                                           *
00024 \*===========================================================================*/
00025 
00026 //=============================================================================
00027 //
00028 //  CLASS newClass
00029 //
00030 //=============================================================================
00031 
00032 #ifndef OPENMESH_VDPROGMESH_VHIERARCHYNODE_HH
00033 #define OPENMESH_VDPROGMESH_VHIERARCHYNODE_HH
00034 
00035 
00036 //== INCLUDES =================================================================
00037 
00038 
00039 #include <vector>
00040 #include <list>
00041 #include <OpenMesh/Core/Math/VectorT.hh>
00042 #include <OpenMesh/Core/Mesh/Kernels/Common/Handles.hh>
00043 #include <OpenMesh/Tools/VDPM/VHierarchyNodeIndex.hh>
00044 
00045 
00046 //== FORWARDDECLARATIONS ======================================================
00047 
00048 
00049 //== NAMESPACES ===============================================================
00050 
00051 namespace OpenMesh {
00052 namespace VDPM {
00053 
00054 //== CLASS DEFINITION =========================================================
00055 
00056               
00059 struct VHierarchyNodeHandle : public BaseHandle
00060 {
00061   explicit VHierarchyNodeHandle(int _idx=-1) : BaseHandle(_idx) {}
00062 };
00063 
00064 
00066 static const VHierarchyNodeHandle InvalidVHierarchyNodeHandle;
00067 
00068 
00072 class VHierarchyNode
00073 {
00074 public:
00075 
00076   VHierarchyNode() { }
00077 
00079   bool is_root() const
00080   { return (parent_handle_.is_valid() == false) ? true : false; }
00081 
00083   bool is_leaf() const
00084   { return (lchild_handle_.is_valid() == false) ? true : false; }
00085   
00087   VHierarchyNodeHandle parent_handle() { return parent_handle_; }
00088   
00090   VHierarchyNodeHandle lchild_handle() { return lchild_handle_; }
00091 
00093   VHierarchyNodeHandle rchild_handle() 
00094   { return VHierarchyNodeHandle(lchild_handle_.idx()+1); }
00095 
00096   void set_parent_handle(VHierarchyNodeHandle _parent_handle)
00097   { parent_handle_ = _parent_handle; }
00098 
00099   void set_children_handle(VHierarchyNodeHandle _lchild_handle)
00100   { lchild_handle_ = _lchild_handle; }
00101 
00102   VertexHandle vertex_handle() const                  { return vh_; }
00103   float radius() const                                { return radius_; }
00104   const OpenMesh::Vec3f& normal() const               { return normal_; }
00105   float sin_square() const                            { return sin_square_; }
00106   float mue_square() const                            { return mue_square_; }
00107   float sigma_square() const                          { return sigma_square_; }
00108 
00109   void set_vertex_handle(OpenMesh::VertexHandle _vh)  { vh_     = _vh; }
00110   void set_radius(float _radius)                      { radius_ = _radius; }
00111   void set_normal(const OpenMesh::Vec3f &_normal)     { normal_ = _normal; }
00112   
00113   void set_sin_square(float _sin_square)      { sin_square_ = _sin_square; }
00114   void set_mue_square(float _mue_square)      { mue_square_ = _mue_square; }
00115   void set_sigma_square(float _sigma_square)  { sigma_square_ = _sigma_square; }
00116   
00117   void set_semi_angle(float _semi_angle) 
00118   { float f=sinf(_semi_angle); sin_square_ = f*f; }
00119 
00120   void set_mue(float _mue)                        { mue_square_ = _mue * _mue; }
00121   void set_sigma(float _sigma)              { sigma_square_ = _sigma * _sigma; }
00122 
00123   const VHierarchyNodeIndex& node_index() const         { return  node_index_; }
00124   const VHierarchyNodeIndex& fund_lcut_index() const 
00125   { return  fund_cut_node_index_[0]; }
00126 
00127   const VHierarchyNodeIndex& fund_rcut_index() const
00128   { return  fund_cut_node_index_[1]; }
00129 
00130   VHierarchyNodeIndex& node_index()
00131   { return  node_index_; }
00132 
00133   VHierarchyNodeIndex& fund_lcut_index()   { return  fund_cut_node_index_[0]; }
00134   VHierarchyNodeIndex& fund_rcut_index()   { return  fund_cut_node_index_[1]; }
00135 
00136   void set_index(const VHierarchyNodeIndex &_node_index)
00137   { node_index_ = _node_index; }
00138 
00139   void set_fund_lcut(const VHierarchyNodeIndex &_node_index)
00140   { fund_cut_node_index_[0] = _node_index; }
00141 
00142   void set_fund_rcut(const VHierarchyNodeIndex &_node_index)
00143   { fund_cut_node_index_[1] = _node_index; }
00144 
00145 private:
00146   VertexHandle            vh_;
00147   float                   radius_;
00148   Vec3f                   normal_;
00149   float                   sin_square_;
00150   float                   mue_square_;
00151   float                   sigma_square_;
00152 
00153   VHierarchyNodeHandle    parent_handle_;
00154   VHierarchyNodeHandle    lchild_handle_;
00155 
00156 
00157   VHierarchyNodeIndex     node_index_;
00158   VHierarchyNodeIndex     fund_cut_node_index_[2];
00159 };
00160 
00162 typedef std::vector<VHierarchyNode>         VHierarchyNodeContainer;
00163 
00165 typedef std::vector<VHierarchyNodeHandle>   VHierarchyNodeHandleContainer;
00166 
00168 typedef std::list<VHierarchyNodeHandle>     VHierarchyNodeHandleList;
00169 
00170 
00171 //=============================================================================
00172 } // namesapce VDPM
00173 } // namespace OpenMesh
00174 //=============================================================================
00175 #endif //  OPENMESH_VDPROGMESH_VHIERARCHYNODE_HH defined
00176 //=============================================================================

acg pic Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .