Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4851 in orxonox.OLD for orxonox/trunk/src/lib


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
Files:
3 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
  • orxonox/trunk/src/lib/math/vector.h

    r4845 r4851  
    245245
    246246  public:
    247     Rectangle() {}
     247    Rectangle() { this->center = new Vector(); }
    248248    virtual ~Rectangle() {}
    249249
    250250    /** \brief sets the center of the rectangle to a defined vector @param center the new center */
    251    inline void setCenter(const Vector &center) { this->center = center;}
     251   inline void setCenter(const Vector &center) { *this->center = center;}
    252252    /** \brief sets the center of the rectangle to a defined vector @param x coord of the center @param y coord of the center @param z coord of the center */
    253    inline void setCenter(float x, float y, float z) { this->center.x = x; this->center.y = y; this->center.z = z; }
     253   inline void setCenter(float x, float y, float z) { this->center->x = x; this->center->y = y; this->center->z = z; }
    254254   /** \brief returns the center of the rectangle to a defined vector @returns center the new center */
    255    inline const Vector* getCenter() const { return &this->center; }
     255   inline const Vector* getCenter() const { return this->center; }
    256256
    257257   /** \brief sets both axis of the rectangle to a defined vector @param unityLength the new center */
     
    261261
    262262  private:
    263     Vector center;
    264     float axis[2];
    265 };
     263    Vector*         center;
     264    float           axis[2];
     265};
     266
     267
    266268#endif /* _VECTOR_H */
Note: See TracChangeset for help on using the changeset viewer.