Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc @ 4629

Last change on this file since 4629 was 4629, checked in by patrick, 19 years ago

orxonox/trunk: now working with smaller jacobi algorithm. got some other very vard to debug segfaults

File size: 19.8 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
10
11### File Specific:
12   main-programmer: Patrick Boenzli
13   co-programmer: ...
14*/
15
16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_COLLISION
17
18#include "obb_tree_node.h"
19#include "list.h"
20#include "obb.h"
21#include "obb_tree.h"
22#include "vector.h"
23#include "abstract_model.h"
24
25#include <math.h>
26
27
28#define WANT_STREAM
29#define WANT_MATH
30#define WANT_FSTREAM
31
32
33#include "include.h"
34#include "newmat.h"
35#include "newmatap.h"
36#include "newmatio.h"
37
38#include "lin_alg.h"
39
40
41
42
43using namespace std;
44
45OBBTree*  OBBTreeNode::obbTree = NULL;
46
47/**
48   \brief standard constructor
49 */
50OBBTreeNode::OBBTreeNode ()
51{
52  this->setClassID(CL_OBB_TREE_NODE, "OBBTreeNode");
53  this->nodeLeft = NULL;
54  this->nodeRight = NULL;
55}
56
57
58/**
59   \brief standard deconstructor
60 */
61OBBTreeNode::~OBBTreeNode ()
62{
63  // delete what has to be deleted here
64}
65
66
67
68/**
69   \brief creates a new BVTree or BVTree partition
70   \param depth: how much more depth-steps to go: if == 1 don't go any deeper!
71   \param verticesList: the list of vertices of the object - each vertices triple is interpreted as a triangle
72 */
73void OBBTreeNode::spawnBVTree(const int depth, sVec3D *verticesList, const int length)
74{
75  printf("OBB Depth: %i, numVertices: %i\n", depth, length);
76  this->depth = depth;
77
78  this->bvElement = this->createBox();
79  PRINTF(0)("Created OBBox\n");
80  this->calculateBoxAttributes(this->bvElement, verticesList, length);
81  PRINTF(0)("Calculated attributes\n");
82
83  if( likely( this->depth > 0))
84  {
85    this->forkBox(this->bvElement);
86
87  }
88}
89
90
91OBB* OBBTreeNode::createBox()
92{
93  return new OBB();
94}
95
96
97void OBBTreeNode::calculateBoxAttributes(OBB* box, sVec3D* verticesList, int length)
98{
99  float     facelet[length];                         //!< surface area of the i'th triangle of the convex hull
100  float     face;                                    //!< surface area of the entire convex hull
101  Vector    centroid[length];                        //!< centroid of the i'th convex hull
102  Vector    center;                                  //!< the center of the entire hull
103  Vector    p, q, r;                                 //!< holder of the polygon data, much more conveniant to work with Vector than sVec3d
104  Vector    t1, t2;                                  //!< temporary values
105  float     covariance[3][3];                        //!< the covariance matrix
106
107  this->numOfVertices = length;
108  this->vertices = verticesList;
109  box->vertices = verticesList;
110  box->numOfVertices = length;
111
112
113  /* fist compute all the convex hull face/facelets and centroids */
114  for(int i = 0; i < length; i+=3)          /* FIX-ME-QUICK: hops of 3, array indiscontinuity*/
115  {
116    p = verticesList[i];
117    q = verticesList[i +1];
118    r = verticesList[i + 2];
119
120    t1 = p - q; t2 = p - r;
121
122    /* finding the facelet surface via cross-product */
123    facelet[i] = 0.5f * fabs( t1.cross(t2).len() );
124    /* update the entire convex hull surface */
125    face += facelet[i];
126
127    /* calculate the cetroid of the hull triangles */
128    centroid[i] = (p + q + r) * 1/3;
129    /* now calculate the centroid of the entire convex hull, weighted average of triangle centroids */
130    center += centroid[i] * facelet[i];
131  }
132  /* take the average of the centroid sum */
133  center /= face;
134  PRINTF(0)("-- Calculated Center\n");
135
136
137  /* now calculate the covariance matrix - if not written in three for-loops, it would compute faster: minor */
138  for(int j = 0; j < 3; ++j)
139  {
140    for(int k = 0; k < 3; ++k)
141    {
142      for(int i = 0; i < length; i+=3)
143      {
144        p = verticesList[i];
145        q = verticesList[i +1];
146        r = verticesList[i + 2];
147
148        covariance[j][k] = facelet[i] / (12.0f * face) * (9.0f * centroid[i][j] * centroid[i][k] + p[j]* p[k] +
149            q[j] * q[k] + r[j]*r[k]) - center[j] * center[k];
150      }
151    }
152  }
153  PRINTF(0)("-- Calculated Covariance\n");
154
155//   printf("\nVertex Data:\n");
156//   for(int i = 0; i < length; i++)
157//   {
158//     printf("vertex %i: %f, %f, %f\n", i, verticesList[i][0], verticesList[i][1], verticesList[i][2]);
159//   }
160
161//   printf("\nCovariance Matrix:\n");
162//   for(int j = 0; j < 3; ++j)
163//   {
164//     printf(" |");
165//     for(int k = 0; k < 3; ++k)
166//     {
167//       printf(" \b%f ", covariance[j][k]);
168//     }
169//     printf(" |\n");
170//   }
171//   printf("center: %f, %f, %f\n\n", center.x, center.y, center.z);
172
173
174  for(int i = 0; i < 3; ++i)
175  {
176
177    box->covarianceMatrix[i][0] = covariance[i][0];
178    box->covarianceMatrix[i][1] = covariance[i][1];
179    box->covarianceMatrix[i][3] = covariance[i][2];
180  }
181  *box->center = center;
182  PRINTF(0)("-- Written Result to obb\n");
183
184  /* now getting spanning vectors of the sub-space:
185  the eigenvectors of a symmertric matrix, such as the
186  covarience matrix are mutually orthogonal.
187  after normalizing them, they can be used as a the basis
188  vectors
189  */
190 /* Matrix                V(3,3);    */                           //!< for eigenvectors
191 /* DiagonalMatrix        D(3);   */                              //!< for eigenvalues
192/*  SymmetricMatrix       C(3); */                                //!< for the covariance symmetrical matrix
193  Vector**              axis = new Vector*[3];                //!< the references to the obb axis
194
195
196  /* new jacobi tests */
197  float** a = new float*[4];
198  a[0] = new float[4]; a[1] = new float[4]; a[2] = new float[4]; a[3] = new float[4];
199
200  float** b = new float*[4];
201  b[0] = new float[4]; b[1] = new float[4]; b[2] = new float[4]; b[3] = new float[4];
202
203  float eigval[3];
204
205  int* rot = new int;
206
207
208  a[1][1] = covariance[0][0];
209  a[1][2] = covariance[0][1];
210  a[1][3] = covariance[0][2];
211  a[2][1] = covariance[1][0];
212  a[2][2] = covariance[1][1];
213  a[2][3] = covariance[1][2];
214  a[3][1] = covariance[2][0];
215  a[3][2] = covariance[2][1];
216  a[3][3] = covariance[2][2];
217
218
219  JacobI(a, 3, eigval, b, rot);
220  PRINTF(0)("-- Done Jacobi Decomposition\n");
221
222
223
224//   printf("Jacobi\n");
225//   for(int j = 1; j < 4; ++j)
226//   {
227//     printf(" |");
228//     for(int k = 1; k < 4; ++k)
229//     {
230//       printf(" \b%f ", b[j][k]);
231//     }
232//     printf(" |\n");
233//   }
234
235  axis[0] = new Vector(b[1][1], b[2][1], b[3][1]);
236  axis[1] = new Vector(b[1][2], b[2][2], b[3][2]);
237  axis[2] = new Vector(b[1][3], b[2][3], b[3][3]);
238  box->axis = axis;
239  PRINTF(0)("-- Got Axis\n");
240
241  delete [] a[0];
242  delete [] a[1];
243  delete [] a[2];
244  delete [] a[3];
245  delete [] a;
246
247  delete [] b[0];
248  delete [] b[1];
249  delete [] b[2];
250  delete [] b[3];
251  delete [] b;
252
253
254//   printf("\neigenvector: %f, %f, %f\n", box->axis[0]->x, box->axis[0]->y, box->axis[0]->z);
255//   printf("eigenvector: %f, %f, %f\n", box->axis[1]->x, box->axis[1]->y, box->axis[1]->z);
256//   printf("eigenvector: %f, %f, %f\n", box->axis[2]->x, box->axis[2]->y, box->axis[2]->z);
257
258
259  /* now get the axis length */
260  Line                ax[3];                                 //!< the axis
261  float*              halfLength = new float[3];             //!< half length of the axis
262  float               tmpLength;                             //!< tmp save point for the length
263  Plane               p0(*box->axis[0], *box->center);       //!< the axis planes
264  Plane               p1(*box->axis[1], *box->center);
265  Plane               p2(*box->axis[2], *box->center);
266
267  halfLength[0] = -1.0f;
268  for(int j = 0; j < length; ++j)
269  {
270    tmpLength = fabs(p0.distancePoint(vertices[j]));
271    if( tmpLength > halfLength[0])
272      halfLength[0] = tmpLength;
273  }
274
275  halfLength[1] = -1.0f;
276  for(int j = 0; j < length; ++j)
277  {
278    tmpLength = fabs(p1.distancePoint(vertices[j]));
279    if( tmpLength > halfLength[1])
280      halfLength[1] = tmpLength;
281  }
282
283  halfLength[2] = -1.0f;
284  for(int j = 0; j < length; ++j)
285  {
286    tmpLength = fabs(p2.distancePoint(vertices[j]));
287    if( tmpLength > halfLength[2])
288      halfLength[2] = tmpLength;
289  }
290
291  box->halfLength = halfLength;
292  PRINTF(0)("-- Written Axis to obb\n");
293
294
295//   printf("\nwe got length: \n");
296//   for(int i = 0; i < 3; ++i)
297//     printf("length[%i] = %f\n", i, box->halfLength[i]);
298}
299
300
301
302/**
303  \brief this separates an ob-box in the middle
304  \param box: the box to separate
305
306  this will separate the box into to smaller boxes. the separation is done along the middle of the longest axis
307 */
308void OBBTreeNode::forkBox(OBB* box)
309{
310  /* get the longest axis of the box */
311  float               aLength = -1.0f;                     //!< the length of the longest axis
312  int                 axisIndex = 0;                       //!< this is the nr of the longest axis
313
314  for(int i = 0; i < 3; ++i)
315  {
316    if( aLength < box->halfLength[i])
317    {
318      aLength = box->halfLength[i];
319      axisIndex = i;
320    }
321  }
322
323//   printf("\nlongest axis is: nr %i with a half-length of: %f\n", axisIndex, aLength);
324
325
326  /* get the closest vertex near the center */
327  float               dist = 999999.0f;                    //!< the smallest distance to each vertex
328  float               tmpDist;                             //!< temporary distance
329  int                 vertexIndex;
330  Plane               middlePlane(*box->axis[axisIndex], *box->center); //!< the middle plane
331
332  for(int i = 0; i < box->numOfVertices; ++i)
333  {
334    tmpDist = fabs(middlePlane.distancePoint(box->vertices[i]));
335    if( tmpDist < dist)
336    {
337      dist = tmpDist;
338      vertexIndex = i;
339    }
340  }
341
342//   printf("\nthe clostest vertex is nr: %i, with a dist of: %f\n", vertexIndex ,dist);
343
344
345  /* now definin the separation plane through this specified nearest point and partition
346  the points depending on which side they are located
347  */
348  Plane              separationPlane(*box->axis[axisIndex], box->vertices[vertexIndex]);  //!< separation plane
349  tList<sVec3D>      partition1;                           //!< the vertex partition 1
350  tList<sVec3D>      partition2;                           //!< the vertex partition 2
351
352  for(int i = 0; i < box->numOfVertices; ++i)
353  {
354    if( separationPlane.distancePoint(box->vertices[i]) > 0.0f)
355      partition1.add(&box->vertices[i]);
356    else
357      partition2.add(&box->vertices[i]);
358  }
359  partition1.add(&box->vertices[vertexIndex]);
360
361//   printf("\npartition1: got %i vertices/ partition 2: got %i vertices\n", partition1.getSize(), partition2.getSize());
362
363
364  /* now comes the separation into two different sVec3D arrays */
365  tIterator<sVec3D>* iterator;                             //!< the iterator to go through the lists
366  sVec3D*            element;                              //!< the elements
367  int                index;                                //!< index storage place
368  sVec3D*            vertList1;                            //!< the vertex list 1
369  sVec3D*            vertList2;                            //!< the vertex list 2
370
371  vertList1 = new sVec3D[partition1.getSize()];
372  vertList2 = new sVec3D[partition2.getSize()];
373
374  iterator = partition1.getIterator();
375  element = iterator->nextElement();
376  index = 0;
377  while( element != NULL)
378  {
379    vertList1[index][0] = element[0][0];
380    vertList1[index][1] = element[0][1];
381    vertList1[index][2] = element[0][2];
382    ++index;
383    element = iterator->nextElement();
384  }
385
386//   printf("\npartition 1:\n");
387//   for(int i = 0; i < partition1.getSize(); ++i)
388//   {
389//     printf("v[%i][0] = %f\n", i, vertList1[i][0]);
390//     printf("v[%i][1] = %f\n", i, vertList1[i][1]);
391//     printf("v[%i][2] = %f\n", i, vertList1[i][2]);
392//   }
393
394  iterator = partition2.getIterator();
395  element = iterator->nextElement();
396  index = 0;
397  while( element != NULL)
398  {
399    vertList2[index][0] = element[0][0];
400    vertList2[index][1] = element[0][1];
401    vertList2[index][2] = element[0][2];
402    ++index;
403    element = iterator->nextElement();
404  }
405
406  //delete iterator;
407//   printf("\npartition 2:\n");
408//   for(int i = 0; i < partition2.getSize(); ++i)
409//   {
410//     printf("v[%i][0] = %f\n", i, vertList2[i][0]);
411//     printf("v[%i][1] = %f\n", i, vertList2[i][1]);
412//     printf("v[%i][2] = %f\n", i, vertList2[i][2]);
413//   }
414
415  /* now spawn the obb tree: create the nodes and descent */
416  OBBTreeNode*       node1 = new OBBTreeNode();
417  OBBTreeNode*       node2 = new OBBTreeNode();
418
419  this->nodeLeft = node1;
420  this->nodeRight = node2;
421
422  this->nodeLeft->spawnBVTree(depth - 1, vertList1, partition1.getSize());
423  this->nodeRight->spawnBVTree(depth - 1, vertList2, partition2.getSize());
424}
425
426
427
428
429void OBBTreeNode::collideWith(const BVTree &tree)
430{}
431
432
433
434
435void OBBTreeNode::drawBV(int depth) const
436{
437  glBegin(GL_TRIANGLES);
438  glColor3f(1.0, 1.0, 1.0);
439  for(int i = 0; i < this->bvElement->numOfVertices; ++i)
440    {
441      glVertex3f(this->bvElement->vertices[i][0], this->bvElement->vertices[i][1], this->bvElement->vertices[i][2]);
442      //printf("v(%f, %f, %f)\n", this->vertices[i][0], this->vertices[i][1], this->vertices[i][2]);
443    }
444  glEnd();
445  //this->drawBVPolygon(depth);
446}
447
448
449void OBBTreeNode::drawBVPolygon(int depth) const
450{
451  //OBBTree::material->select();
452
453  this->obbTree->getMaterial(depth)->select();
454
455  /* draw world axes */
456//   glBegin(GL_LINES);
457//   glColor3f(0.0, 0.4, 0.3);
458//   glVertex3f(0.0, 0.0, 0.0);
459//   glVertex3f(3.0, 0.0, 0.0);
460//
461//   glVertex3f(0.0, 0.0, 0.0);
462//   glVertex3f(0.0, 3.0, 0.0);
463//
464//   glVertex3f(0.0, 0.0, 0.0);
465//   glVertex3f(0.0, 0.0, 3.0);
466//   glEnd();
467
468
469
470  /* draw the obb axes */
471//   glBegin(GL_LINES);
472//   glColor3f(0.0, 0.4, 0.3);
473//   glVertex3f(this->bvElement->center->x, this->bvElement->center->y, this->bvElement->center->z);
474//   glVertex3f(this->bvElement->center->x + this->bvElement->axis[0]->x * this->bvElement->halfLength[0],
475//              this->bvElement->center->y + this->bvElement->axis[0]->y * this->bvElement->halfLength[0],
476//              this->bvElement->center->z + this->bvElement->axis[0]->z * this->bvElement->halfLength[0]);
477//
478//   glVertex3f(this->bvElement->center->x, this->bvElement->center->y, this->bvElement->center->z);
479//   glVertex3f(this->bvElement->center->x + this->bvElement->axis[1]->x * this->bvElement->halfLength[1],
480//              this->bvElement->center->y + this->bvElement->axis[1]->y * this->bvElement->halfLength[1],
481//              this->bvElement->center->z + this->bvElement->axis[1]->z * this->bvElement->halfLength[1]);
482//
483//   glVertex3f(this->bvElement->center->x, this->bvElement->center->y, this->bvElement->center->z);
484//   glVertex3f(this->bvElement->center->x + this->bvElement->axis[2]->x * this->bvElement->halfLength[2],
485//              this->bvElement->center->y + this->bvElement->axis[2]->y * this->bvElement->halfLength[2],
486//              this->bvElement->center->z + this->bvElement->axis[2]->z * this->bvElement->halfLength[2]);
487//   glEnd();
488
489
490  Vector cen = *this->bvElement->center;
491  Vector** axis = this->bvElement->axis;
492  float* len = this->bvElement->halfLength;
493
494  /* draw bounding box */
495  glBegin(GL_LINE_LOOP);
496  glColor3f(0.3, 0.4, 0.7);
497  glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
498             cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
499             cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);
500  glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
501             cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
502             cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
503  glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2],
504             cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2],
505             cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]);
506  glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2],
507             cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2],
508             cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]);
509  glEnd();
510
511  glBegin(GL_LINE_LOOP);
512  glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2],
513             cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2],
514             cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]);
515  glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2],
516             cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2],
517             cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]);
518  glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2],
519             cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2],
520             cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]);
521  glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2],
522             cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2],
523             cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]);
524  glEnd();
525
526  glBegin(GL_LINE_LOOP);
527  glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2],
528             cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2],
529             cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]);
530  glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2],
531             cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2],
532             cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]);
533  glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
534             cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
535             cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
536  glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
537             cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
538             cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);
539  glEnd();
540
541  glBegin(GL_LINE_LOOP);
542  glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
543             cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
544             cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
545  glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
546             cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
547             cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);
548  glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
549             cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
550             cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);
551  glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
552             cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
553             cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
554  glEnd();
555
556/*
557  glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
558  cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
559  cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
560  glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
561  cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
562  cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);*/
563
564
565  glEnd();
566
567  if( this->nodeLeft != NULL && depth != 0 )
568    this->nodeLeft->drawBVPolygon(depth - 1);
569  if( this->nodeRight != NULL && depth != 0)
570    this->nodeRight->drawBVPolygon(depth - 1);
571
572}
573
574
575void OBBTreeNode::drawBVBlended(int depth) const
576{}
577
578
579void OBBTreeNode::debug()
580{
581
582  /*
583  for(int i = 0; i < length; i++)
584  {
585  printf("vertex %i: %f, %f, %f\n", i, verticesList[i][0], verticesList[i][1], verticesList[i][2]);
586}
587  */
588}
Note: See TracBrowser for help on using the repository browser.