Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4867 in orxonox.OLD


Ignore:
Timestamp:
Jul 14, 2005, 11:26:17 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: implemented the tree stepping functions and some minor corrections in the main functions

Location:
orxonox/trunk/src/lib/graphics/spatial_separation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc

    r4859 r4867  
    2626 *  standard constructor
    2727*/
    28 QuadtreeNode::QuadtreeNode (sTriangleExt* triangles, int numTriangles, Quadtree* quadtree)
    29 {
     28QuadtreeNode::QuadtreeNode (sTriangleExt** triangles, int numTriangles, Quadtree* quadtree)
     29{
     30  this->pTriangles = triangles;
     31  this->numTriangles = numTriangles;
     32  this->quadtree = quadtree;
     33 
    3034  this->init();
    3135}
     
    5862
    5963  this->offset = 0.0f;
     64  this->nodeA = NULL;
     65  this->nodeB = NULL;
     66  this->nodeC = NULL;
     67  this->nodeD = NULL;
    6068}
    6169
     
    6674QuadtreeNode::~QuadtreeNode ()
    6775{
     76  if( this->nodeA != NULL)
     77    delete this->nodeA;
     78  if( this->nodeB != NULL)
     79    delete this->nodeB;
     80  if( this->nodeC != NULL)
     81    delete this->nodeC;
     82  if( this->nodeD != NULL)
     83    delete this->nodeD;
    6884}
    6985
     
    7591void QuadtreeNode::separateNode(int treeDepth)
    7692{
     93  if( treeDepth <= 0)
     94    return;
    7795  this->separateNode();
     96
     97  this->nodeA->separateNode(treeDepth - 1);
     98  this->nodeB->separateNode(treeDepth - 1);
     99  this->nodeC->separateNode(treeDepth - 1);
     100  this->nodeD->separateNode(treeDepth - 1);
    78101}
    79102
     
    85108void QuadtreeNode::separateNode(float minLength)
    86109{
     110  if( minLength <= this->pDimension->getAxis())
     111    return;
    87112  this->separateNode();
     113
     114  this->nodeA->separateNode(minLength);
     115  this->nodeB->separateNode(minLength);
     116  this->nodeC->separateNode(minLength);
     117  this->nodeD->separateNode(minLength);
    88118}
    89119
     
    130160  sTriangleExt**                 pTriC;                                 //!< Triangle array C
    131161  sTriangleExt**                 pTriD;                                 //!< Triangle array D
    132   float                          lenA;                                  //!< length array A
    133   float                          lenB;                                  //!< length array B
    134   float                          lenC;                                  //!< length array C
    135   float                          lenD;                                  //!< length array D
     162  int                            lenA;                                  //!< length array A
     163  int                            lenB;                                  //!< length array B
     164  int                            lenC;                                  //!< length array C
     165  int                            lenD;                                  //!< length array D
    136166  tIterator<sTriangleExt*>*      iterator;                              //!< iterator for the list iterations
    137167  sTriangleExt**                 tempTri;                               //!< temp save place for triangle pointer
     
    197227
    198228  /* now propagate */
    199   /*
    200229  this->nodeA = new QuadtreeNode(pTriA, lenA, this->quadtree);
    201   this->nodeA->separate();
    202 
    203230  this->nodeB = new QuadtreeNode(pTriB, lenB, this->quadtree);
    204   this->nodeB->separate();
    205 
    206231  this->nodeC = new QuadtreeNode(pTriC, lenC, this->quadtree);
    207   this->nodeC->separate();
    208 
    209232  this->nodeD = new QuadtreeNode(pTriD, lenD, this->quadtree);
    210   this->nodeD->separate();
    211   */
     233
    212234
    213235  PRINTF(0)("separation complete\n");
  • orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h

    r4852 r4867  
    2020
    2121  public:
    22     QuadtreeNode(sTriangleExt* triangles, int numTriangles, Quadtree* quadtree);
     22    QuadtreeNode(sTriangleExt** triangles, int numTriangles, Quadtree* quadtree);
    2323    QuadtreeNode(modelInfo* pModelInfo);
    2424    virtual ~QuadtreeNode();
Note: See TracChangeset for help on using the changeset viewer.