Changeset 4851 in orxonox.OLD for orxonox/trunk/src/lib
- Timestamp:
- Jul 13, 2005, 9:07:13 PM (19 years ago)
- Location:
- orxonox/trunk/src/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.cc
r4846 r4851 17 17 18 18 #include "quadtree_node.h" 19 #include "list.h" 20 #include "vector.h" 19 21 20 22 using namespace std; … … 36 38 { 37 39 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 39 49 } 40 50 41 51 42 52 /** 43 53 * standard deconstructor … … 63 73 void QuadtreeNode::separateNode(float minLength) 64 74 {} 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 */ 81 void 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 } 65 102 66 103 -
orxonox/trunk/src/lib/graphics/spatial_separation/quadtree_node.h
r4845 r4851 26 26 void separateNode(int treeDepth); 27 27 void separateNode(float minLength); 28 void separateNode(); 28 29 29 30 void drawTree(int depth, int drawMode) const; … … 38 39 float axisLength; //!< axis length of the quadtree 39 40 float maxHeigth; //!< max height of the model in the quadtree 41 float offset; //!< offset of the actual quadtree rectangle 40 42 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 42 45 unsigned int numTriangles; //!< number of triangles of the Node 43 46 modelInfo* pModelInfo; //!< reference to the modelInfo of the object 47 Rectangle* pDimension; //!< pointer to the local rectangle properties 44 48 45 49 QuadtreeNode* nodeA; //!< reference to the node A -
orxonox/trunk/src/lib/math/vector.h
r4845 r4851 245 245 246 246 public: 247 Rectangle() { }247 Rectangle() { this->center = new Vector(); } 248 248 virtual ~Rectangle() {} 249 249 250 250 /** \brief sets the center of the rectangle to a defined vector @param center the new center */ 251 inline void setCenter(const Vector ¢er) { this->center = center;}251 inline void setCenter(const Vector ¢er) { *this->center = center;} 252 252 /** \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; } 254 254 /** \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; } 256 256 257 257 /** \brief sets both axis of the rectangle to a defined vector @param unityLength the new center */ … … 261 261 262 262 private: 263 Vector center; 264 float axis[2]; 265 }; 263 Vector* center; 264 float axis[2]; 265 }; 266 267 266 268 #endif /* _VECTOR_H */
Note: See TracChangeset
for help on using the changeset viewer.