Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 13, 2005, 9:07:13 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: start of the separation algorithm

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

    r4846 r4851  
    1717
    1818#include "quadtree_node.h"
     19#include "list.h"
     20#include "vector.h"
    1921
    2022using namespace std;
     
    3638{
    3739  this->pModelInfo = pModelInfo;
    38   this->getDimension(this->pModelInfo);
     40  this->pDimension = this->getDimension(this->pModelInfo);
     41 
     42  /* create an array of triangle references */
     43  this->pTriangles = new sTriangleExt*[this->pModelInfo->numTriangles];
     44  this->numTriangles = this->pModelInfo->numTriangles;
     45  this->pVertices = this->pModelInfo->pVertices;
     46  for( int i = 0; i < this->pModelInfo->numTriangles; ++i)
     47    this->pTriangles[i] = &this->pModelInfo->pTriangles[i];
     48 
    3949}
    4050
    41 
     51 
    4252/**
    4353 *  standard deconstructor
     
    6373void QuadtreeNode::separateNode(float minLength)
    6474{}
     75
     76
     77/**
     78 *  gives the signal to separate the model into a quadtree
     79 * @param treeDepth the max depth, the steps to go if treeDept == 0 leaf reached
     80*/
     81void QuadtreeNode::separateNode()
     82{
     83  tList<sTriangleExt*>*           listA = new tList<sTriangleExt*>();    //!< triangle list of nodeA
     84  tList<sTriangleExt*>*           listB = new tList<sTriangleExt*>();    //!< triangle list of nodeB
     85  tList<sTriangleExt*>*           listC = new tList<sTriangleExt*>();    //!< triangle list of nodeC
     86  tList<sTriangleExt*>*           listD = new tList<sTriangleExt*>();    //!< triangle list of nodeD
     87  const float*                    pVert;                                 //!< pointer to the vertices
     88  const Vector*                   rectCenter;                            //!< vector to the center of the rect
     89
     90  rectCenter = this->pDimension->getCenter();
     91  for( int i = 0; i < this->numTriangles; ++i)
     92    {
     93      for( int j = 0; j < 3; ++j)
     94        {
     95          pVert = &this->pVertices[this->pTriangles[i]->indexToVertices[j]];
     96          if(  pVert[0] > rectCenter->x + this->offset && pVert[2] > rectCenter->z + this->offset)
     97            printf("");
     98
     99        }
     100    }
     101}
    65102
    66103
  • orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h

    r4845 r4851  
    2626    void separateNode(int treeDepth);
    2727    void separateNode(float minLength);
     28    void separateNode();
    2829
    2930    void drawTree(int depth, int drawMode) const;
     
    3839    float                           axisLength;         //!< axis length of the quadtree
    3940    float                           maxHeigth;          //!< max height of the model in the quadtree
     41    float                           offset;             //!< offset of the actual quadtree rectangle
    4042
    41     sTriangleExt*                   triangles;          //!< reference to the triangles of the node
     43    sTriangleExt**                  pTriangles;         //!< reference to the triangles of the node
     44    const float*                    pVertices;          //!< reference to vertices data
    4245    unsigned int                    numTriangles;       //!< number of triangles of the Node
    4346    modelInfo*                      pModelInfo;         //!< reference to the modelInfo of the object
     47    Rectangle*                      pDimension;         //!< pointer to the local rectangle properties
    4448
    4549    QuadtreeNode*                   nodeA;              //!< reference to the node A
Note: See TracChangeset for help on using the changeset viewer.