From 79794c5b2c8d21b5d600a7cff1cb6bf4b7e48d2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 7 Jun 2010 14:37:24 +0000 Subject: [PATCH] Added missing file git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@9436 383ad7c9-94d9-4d36-a494-682f7c89f535 --- common/bsp/BSPTreeNode.hh | 105 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 common/bsp/BSPTreeNode.hh diff --git a/common/bsp/BSPTreeNode.hh b/common/bsp/BSPTreeNode.hh new file mode 100644 index 00000000..a53bb1c1 --- /dev/null +++ b/common/bsp/BSPTreeNode.hh @@ -0,0 +1,105 @@ +/*===========================================================================*\ + * * + * OpenFlipper * + * Copyright (C) 2001-2009 by Computer Graphics Group, RWTH Aachen * + * www.openflipper.org * + * * + *---------------------------------------------------------------------------* + * This file is part of OpenFlipper. * + * * + * OpenFlipper is free software: you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License as * + * published by the Free Software Foundation, either version 3 of * + * the License, or (at your option) any later version with the * + * following exceptions: * + * * + * If other files instantiate templates or use macros * + * or inline functions from this file, or you compile this file and * + * link it with other files to produce an executable, this file does * + * not by itself cause the resulting executable to be covered by the * + * GNU Lesser General Public License. This exception does not however * + * invalidate any other reasons why the executable file might be * + * covered by the GNU Lesser General Public License. * + * * + * OpenFlipper is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU LesserGeneral Public * + * License along with OpenFlipper. If not, * + * see . * + * * +\*===========================================================================*/ + +/*===========================================================================*\ + * * + * $Revision: 8520 $ * + * $Author: frickenschmidt $ * + * $Date: 2010-02-10 15:56:59 +0100 (Mi, 10. Feb 2010) $ * + * * +\*===========================================================================*/ + + + + +//============================================================================= +// +// CLASS TreeNode +// +//============================================================================= + +#ifndef MB_BSPTREENODE_HH +#define MB_BSPTREENODE_HH + +//== INCLUDES ================================================================= + +#include +#include + +//== CLASS DEFINITION ========================================================= + +// Node of the tree: contains parent, children and splitting plane +template +struct TreeNode +{ + typedef typename Mesh::FaceHandle Handle; + typedef typename Mesh::Point Point; + typedef std::vector Handles; + typedef typename Handles::iterator HandleIter; + typedef typename Point::value_type Scalar; + typedef ACG::Geometry::PlaneT Plane; + + TreeNode(const Handles& _handles, TreeNode* _parent) + : handles_(_handles), + parent_(_parent), left_child_(0), right_child_(0) {} + ~TreeNode() + { + delete left_child_; + delete right_child_; + + if (parent_) + { + if (this == parent_->left_child_) + parent_->left_child_ = 0; + else + parent_->right_child_ = 0; + } + } + + HandleIter begin() { + return handles_.begin(); + } + HandleIter end() { + return handles_.end(); + } + + Handles handles_; + TreeNode *parent_, *left_child_, *right_child_; + Plane plane_; + Point bb_min, bb_max; +}; + +//============================================================================= +#endif // MB_BSPTREENODE_HH defined +//============================================================================= -- GitLab