source: trunk/VUT/GtpVisibilityPreprocessor/include/ViewCellBsp.h @ 225

Revision 225, 1.7 KB checked in by mattausch, 19 years ago (diff)

updated bsp trees

Line 
1#ifndef _ViewCellBsp_H__
2#define _ViewCellBsp_H__
3
4#include "Containers.h"
5
6class ViewCell;
7class Plane3;
8
9namespace GtpVisibilityPreprocessor {
10 
11  class BspInterior;
12
13  /**
14     BspNode abstract class serving for interior and leaf node implementation
15  */
16  class BspNode
17  {
18  public:
19          /** Determines whether this node is a leaf or not
20          @return true if leaf
21          */
22          virtual bool IsLeaf() const = 0;
23   
24          /** Determines whether this node is a root
25          @return true if root
26          */
27          virtual bool IsRoot() const;
28 
29  protected:
30
31          /// parent of this node
32          BspInterior *mParent;
33  };
34
35  /** BSP interior node implementation */
36  class BspInterior : public BspNode
37  {   
38          /** @return false since it is an interior node */
39          bool IsLeaf() const;
40 
41  protected:
42          /// Splitting plane corresponding to this node
43          Plane3 mPlane;
44          /// back node
45          BspNode *mBack;
46          /// front node
47          BspNode *mFront;
48  };
49 
50 
51  /** BSP leaf node implementation.
52  */
53  class BspLeaf : public BspNode
54  {
55  public:
56          BspLeaf(ViewCell *viewCell = NULL);
57          /** @return true since it is an interior node */
58          virtual bool IsLeaf();
59
60  protected:
61          /// polygonal representation of this viewcell
62          /// if NULL this note does not correspond to feasible viewcell
63          ViewCell *mViewCell;
64  };
65 
66  /** Implementation of the ViewCell BSP tree.
67  */
68  class BspTree
69  {
70  public:
71          /** Constructor takes a pointer to the cell corresponding to the whole
72          viewspace */
73          BspTree(ViewCell *cell);
74       
75  protected:
76          /// Pointer to the root of the tree
77          BspNode *mRoot;
78          /// Pointer to the root cell of the viewspace */
79          ViewCell *mRootCell;
80  };
81 
82}; // GtpVisibilityPreprocessor
83
84#endif
Note: See TracBrowser for help on using the repository browser.