Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

orxonox/trunk: trying to implement my own jacobi decomposition alg since the other once didn't work… shit

File size: 19.7 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\n", depth);
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  double    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  double a[4][4];
197
198  a[0][0] = C(1,1) = covariance[0][0];
199  a[0][1] = C(1,2) = covariance[0][1];
200  a[0][2] = C(1,3) = covariance[0][2];
201  a[1][0] = C(2,1) = covariance[1][0];
202  a[1][1] = C(2,2) = covariance[1][1];
203  a[1][2] = C(2,3) = covariance[1][2];
204  a[2][0] = C(3,1) = covariance[2][0];
205  a[2][1] = C(3,2) = covariance[2][1];
206  a[2][2] = C(3,3) = covariance[2][2];
207
208  Jacobi(C, D, V);                                            /* do the jacobi decomposition */
209  PRINTF(0)("-- Done Jacobi Decomposition\n");
210
211
212  /* new jacobi tests */
213  double eigenvectors[3][3];
214  double eigval[3];
215
216  EVJacobi jac;
217  jac.setMatrix(2, covariance, 0, 0);
218  jac.getEigenVector(eigenvectors);
219
220
221  printf("Old Jacobi\n");
222  for(int j = 1; j < 4; ++j)
223  {
224    printf(" |");
225    for(int k = 1; k < 4; ++k)
226    {
227      printf(" \b%f ", V(j, k));
228    }
229    printf(" |\n");
230  }
231
232  printf("New Jacobi\n");
233  for(int j = 0; j < 3; ++j)
234  {
235    printf(" |");
236    for(int k = 0; k < 3; ++k)
237    {
238      printf(" \b%f ", eigenvectors[j][k]);
239    }
240    printf(" |\n");
241  }
242
243  axis[0] = new Vector(V(1, 1), V(2, 1), V(3, 1));
244  axis[1] = new Vector(V(1, 2), V(2, 2), V(3, 2));
245  axis[2] = new Vector(V(1, 3), V(2, 3), V(3, 3));
246  box->axis = axis;
247  PRINTF(0)("-- Got Axis\n");
248
249//   delete &V;
250//   delete &D;
251//   delete &V;
252
253//   printf("\neigenvector: %f, %f, %f\n", box->axis[0]->x, box->axis[0]->y, box->axis[0]->z);
254//   printf("eigenvector: %f, %f, %f\n", box->axis[1]->x, box->axis[1]->y, box->axis[1]->z);
255//   printf("eigenvector: %f, %f, %f\n", box->axis[2]->x, box->axis[2]->y, box->axis[2]->z);
256
257
258  /* now get the axis length */
259  Line                ax[3];                                 //!< the axis
260  float*              halfLength = new float[3];             //!< half length of the axis
261  float               tmpLength;                             //!< tmp save point for the length
262  Plane               p0(*box->axis[0], *box->center);       //!< the axis planes
263  Plane               p1(*box->axis[1], *box->center);
264  Plane               p2(*box->axis[2], *box->center);
265
266  halfLength[0] = -1.0f;
267  for(int j = 0; j < length; ++j)
268  {
269    tmpLength = fabs(p0.distancePoint(vertices[j]));
270    if( tmpLength > halfLength[0])
271      halfLength[0] = tmpLength;
272  }
273
274  halfLength[1] = -1.0f;
275  for(int j = 0; j < length; ++j)
276  {
277    tmpLength = fabs(p1.distancePoint(vertices[j]));
278    if( tmpLength > halfLength[1])
279      halfLength[1] = tmpLength;
280  }
281
282  halfLength[2] = -1.0f;
283  for(int j = 0; j < length; ++j)
284  {
285    tmpLength = fabs(p2.distancePoint(vertices[j]));
286    if( tmpLength > halfLength[2])
287      halfLength[2] = tmpLength;
288  }
289
290  box->halfLength = halfLength;
291  PRINTF(0)("-- Written Axis to obb\n");
292
293
294//   printf("\nwe got length: \n");
295//   for(int i = 0; i < 3; ++i)
296//     printf("length[%i] = %f\n", i, box->halfLength[i]);
297}
298
299
300
301/**
302  \brief this separates an ob-box in the middle
303  \param box: the box to separate
304
305  this will separate the box into to smaller boxes. the separation is done along the middle of the longest axis
306 */
307void OBBTreeNode::forkBox(OBB* box)
308{
309  /* get the longest axis of the box */
310  float               aLength = -1.0f;                     //!< the length of the longest axis
311  int                 axisIndex = 0;                       //!< this is the nr of the longest axis
312
313  for(int i = 0; i < 3; ++i)
314  {
315    if( aLength < box->halfLength[i])
316    {
317      aLength = box->halfLength[i];
318      axisIndex = i;
319    }
320  }
321
322  printf("\nlongest axis is: nr %i with a half-length of: %f\n", axisIndex, aLength);
323
324
325  /* get the closest vertex near the center */
326  float               dist = 999999.0f;                    //!< the smallest distance to each vertex
327  float               tmpDist;                             //!< temporary distance
328  int                 vertexIndex;
329  Plane               middlePlane(*box->axis[axisIndex], *box->center); //!< the middle plane
330
331  for(int i = 0; i < box->numOfVertices; ++i)
332  {
333    tmpDist = fabs(middlePlane.distancePoint(box->vertices[i]));
334    if( tmpDist < dist)
335    {
336      dist = tmpDist;
337      vertexIndex = i;
338    }
339  }
340
341  printf("\nthe clostest vertex is nr: %i, with a dist of: %f\n", vertexIndex ,dist);
342
343
344  /* now definin the separation plane through this specified nearest point and partition
345  the points depending on which side they are located
346  */
347  Plane              separationPlane(*box->axis[axisIndex], box->vertices[vertexIndex]);  //!< separation plane
348  tList<sVec3D>      partition1;                           //!< the vertex partition 1
349  tList<sVec3D>      partition2;                           //!< the vertex partition 2
350
351  for(int i = 0; i < box->numOfVertices; ++i)
352  {
353    if( separationPlane.distancePoint(box->vertices[i]) > 0.0f)
354      partition1.add(&box->vertices[i]);
355    else
356      partition2.add(&box->vertices[i]);
357  }
358  partition1.add(&box->vertices[vertexIndex]);
359
360  printf("\npartition1: got %i vertices/ partition 2: got %i vertices\n", partition1.getSize(), partition2.getSize());
361
362
363  /* now comes the separation into two different sVec3D arrays */
364  tIterator<sVec3D>* iterator;                             //!< the iterator to go through the lists
365  sVec3D*            element;                              //!< the elements
366  int                index;                                //!< index storage place
367  sVec3D*            vertList1;                            //!< the vertex list 1
368  sVec3D*            vertList2;                            //!< the vertex list 2
369
370  vertList1 = new sVec3D[partition1.getSize()];
371  vertList2 = new sVec3D[partition2.getSize()];
372
373  iterator = partition1.getIterator();
374  element = iterator->nextElement();
375  index = 0;
376  while( element != NULL)
377  {
378    vertList1[index][0] = element[0][0];
379    vertList1[index][1] = element[0][1];
380    vertList1[index][2] = element[0][2];
381    ++index;
382    element = iterator->nextElement();
383  }
384
385//   printf("\npartition 1:\n");
386//   for(int i = 0; i < partition1.getSize(); ++i)
387//   {
388//     printf("v[%i][0] = %f\n", i, vertList1[i][0]);
389//     printf("v[%i][1] = %f\n", i, vertList1[i][1]);
390//     printf("v[%i][2] = %f\n", i, vertList1[i][2]);
391//   }
392
393  iterator = partition2.getIterator();
394  element = iterator->nextElement();
395  index = 0;
396  while( element != NULL)
397  {
398    vertList2[index][0] = element[0][0];
399    vertList2[index][1] = element[0][1];
400    vertList2[index][2] = element[0][2];
401    ++index;
402    element = iterator->nextElement();
403  }
404
405  //delete iterator;
406//   printf("\npartition 2:\n");
407//   for(int i = 0; i < partition2.getSize(); ++i)
408//   {
409//     printf("v[%i][0] = %f\n", i, vertList2[i][0]);
410//     printf("v[%i][1] = %f\n", i, vertList2[i][1]);
411//     printf("v[%i][2] = %f\n", i, vertList2[i][2]);
412//   }
413
414  /* now spawn the obb tree: create the nodes and descent */
415  OBBTreeNode*       node1 = new OBBTreeNode();
416  OBBTreeNode*       node2 = new OBBTreeNode();
417
418  this->nodeLeft = node1;
419  this->nodeRight = node2;
420
421  this->nodeLeft->spawnBVTree(depth - 1, vertList1, partition1.getSize());
422  this->nodeRight->spawnBVTree(depth - 1, vertList2, partition2.getSize());
423}
424
425
426
427
428void OBBTreeNode::collideWith(const BVTree &tree)
429{}
430
431
432
433
434void OBBTreeNode::drawBV(int depth) const
435{
436  glBegin(GL_TRIANGLES);
437  glColor3f(1.0, 1.0, 1.0);
438  for(int i = 0; i < this->bvElement->numOfVertices; ++i)
439    {
440      glVertex3f(this->bvElement->vertices[i][0], this->bvElement->vertices[i][1], this->bvElement->vertices[i][2]);
441      //printf("v(%f, %f, %f)\n", this->vertices[i][0], this->vertices[i][1], this->vertices[i][2]);
442    }
443  glEnd();
444  //this->drawBVPolygon(depth);
445}
446
447
448void OBBTreeNode::drawBVPolygon(int depth) const
449{
450  //OBBTree::material->select();
451
452  this->obbTree->getMaterial(depth)->select();
453
454  /* draw world axes */
455//   glBegin(GL_LINES);
456//   glColor3f(0.0, 0.4, 0.3);
457//   glVertex3f(0.0, 0.0, 0.0);
458//   glVertex3f(3.0, 0.0, 0.0);
459//
460//   glVertex3f(0.0, 0.0, 0.0);
461//   glVertex3f(0.0, 3.0, 0.0);
462//
463//   glVertex3f(0.0, 0.0, 0.0);
464//   glVertex3f(0.0, 0.0, 3.0);
465//   glEnd();
466
467
468
469  /* draw the obb axes */
470//   glBegin(GL_LINES);
471//   glColor3f(0.0, 0.4, 0.3);
472//   glVertex3f(this->bvElement->center->x, this->bvElement->center->y, this->bvElement->center->z);
473//   glVertex3f(this->bvElement->center->x + this->bvElement->axis[0]->x * this->bvElement->halfLength[0],
474//              this->bvElement->center->y + this->bvElement->axis[0]->y * this->bvElement->halfLength[0],
475//              this->bvElement->center->z + this->bvElement->axis[0]->z * this->bvElement->halfLength[0]);
476//
477//   glVertex3f(this->bvElement->center->x, this->bvElement->center->y, this->bvElement->center->z);
478//   glVertex3f(this->bvElement->center->x + this->bvElement->axis[1]->x * this->bvElement->halfLength[1],
479//              this->bvElement->center->y + this->bvElement->axis[1]->y * this->bvElement->halfLength[1],
480//              this->bvElement->center->z + this->bvElement->axis[1]->z * this->bvElement->halfLength[1]);
481//
482//   glVertex3f(this->bvElement->center->x, this->bvElement->center->y, this->bvElement->center->z);
483//   glVertex3f(this->bvElement->center->x + this->bvElement->axis[2]->x * this->bvElement->halfLength[2],
484//              this->bvElement->center->y + this->bvElement->axis[2]->y * this->bvElement->halfLength[2],
485//              this->bvElement->center->z + this->bvElement->axis[2]->z * this->bvElement->halfLength[2]);
486//   glEnd();
487
488
489  Vector cen = *this->bvElement->center;
490  Vector** axis = this->bvElement->axis;
491  float* len = this->bvElement->halfLength;
492
493  /* draw bounding box */
494  glBegin(GL_LINE_LOOP);
495  glColor3f(0.3, 0.4, 0.7);
496  glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
497             cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
498             cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);
499  glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
500             cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
501             cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
502  glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2],
503             cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2],
504             cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]);
505  glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2],
506             cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2],
507             cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]);
508  glEnd();
509
510  glBegin(GL_LINE_LOOP);
511  glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2],
512             cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2],
513             cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]);
514  glVertex3f(cen.x + axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2],
515             cen.y + axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2],
516             cen.z + axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]);
517  glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2],
518             cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2],
519             cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]);
520  glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2],
521             cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2],
522             cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]);
523  glEnd();
524
525  glBegin(GL_LINE_LOOP);
526  glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] + axis[2]->x * len[2],
527             cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] + axis[2]->y * len[2],
528             cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] + axis[2]->z * len[2]);
529  glVertex3f(cen.x - axis[0]->x * len[0] - axis[1]->x * len[1] - axis[2]->x * len[2],
530             cen.y - axis[0]->y * len[0] - axis[1]->y * len[1] - axis[2]->y * len[2],
531             cen.z - axis[0]->z * len[0] - axis[1]->z * len[1] - axis[2]->z * len[2]);
532  glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
533             cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
534             cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
535  glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
536             cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
537             cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);
538  glEnd();
539
540  glBegin(GL_LINE_LOOP);
541  glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
542             cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
543             cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
544  glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
545             cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
546             cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);
547  glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
548             cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
549             cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);
550  glVertex3f(cen.x + axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
551             cen.y + axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
552             cen.z + axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
553  glEnd();
554
555/*
556  glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] - axis[2]->x * len[2],
557  cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] - axis[2]->y * len[2],
558  cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] - axis[2]->z * len[2]);
559  glVertex3f(cen.x - axis[0]->x * len[0] + axis[1]->x * len[1] + axis[2]->x * len[2],
560  cen.y - axis[0]->y * len[0] + axis[1]->y * len[1] + axis[2]->y * len[2],
561  cen.z - axis[0]->z * len[0] + axis[1]->z * len[1] + axis[2]->z * len[2]);*/
562
563
564  glEnd();
565
566  if( this->nodeLeft != NULL && depth != 0 )
567    this->nodeLeft->drawBVPolygon(depth - 1);
568  if( this->nodeRight != NULL && depth != 0)
569    this->nodeRight->drawBVPolygon(depth - 1);
570
571}
572
573
574void OBBTreeNode::drawBVBlended(int depth) const
575{}
576
577
578void OBBTreeNode::debug()
579{
580
581  /*
582  for(int i = 0; i < length; i++)
583  {
584  printf("vertex %i: %f, %f, %f\n", i, verticesList[i][0], verticesList[i][1], verticesList[i][2]);
585}
586  */
587}
Note: See TracBrowser for help on using the repository browser.