Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4586 in orxonox.OLD for orxonox/trunk/src/lib/collision_detection


Ignore:
Timestamp:
Jun 10, 2005, 4:25:41 AM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: now the axis get drawn correctly:)

Location:
orxonox/trunk/src/lib/collision_detection
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/collision_detection/obb_tree.cc

    r4581 r4586  
    9797  /* generate some test vertices */
    9898  sVec3D* vertList = new sVec3D[3];
    99   sVec3D data[]  = {{0.0, 0.0, 0.0},{10.0, -5.0, 0.0},{10.0, 5.0, 0.0}};
     99  sVec3D data[]  = {{0.0, 0.0, 0.0},{10.0, -5.0, 5.0},{10.0, 5.0, 0.0}};
    100100
    101101  for(int i = 0; i < 3; ++i)
  • orxonox/trunk/src/lib/collision_detection/obb_tree_node.cc

    r4585 r4586  
    205205  box->axis = axis;
    206206 
    207   printf("eigenvector: %f, %f, %f\n", V(1, 1), V(2, 1), V(3, 1));
    208   printf("eigenvector: %f, %f, %f\n", V(1, 2), V(2, 2), V(3, 2));
    209   printf("eigenvector: %f, %f, %f\n", V(1, 3), V(2, 3), V(3, 3));
    210 
    211   box->axis = axis;
    212 
     207  printf("eigenvector: %f, %f, %f\n", box->axis[0]->x, box->axis[0]->y, box->axis[0]->z);
     208  printf("eigenvector: %f, %f, %f\n", box->axis[1]->x, box->axis[1]->y, box->axis[1]->z);
     209  printf("eigenvector: %f, %f, %f\n", box->axis[2]->x, box->axis[2]->y, box->axis[2]->z);
     210
     211 
    213212  /* now get the axis length */
    214213  Line                ax[3];                                 //!< the axis
     
    251250  }
    252251
    253 
    254 
    255    
    256 //   for(int i = 0; i < 3; ++i)
    257 //   {
    258 //     halfLength[i] = 0.0f;
    259 //     for(int j = 0; j < length; ++j)
    260 //     {
    261 //       tmpLength = ax[i].distancePoint(vertices[j]);
    262 //       if( tmpLength > halfLength[i])
    263 //         halfLength[i] = tmpLength;
    264 //     }
    265 //   }
    266 
    267252  box->halfLength = halfLength;
     253
     254 
    268255 
    269256  printf("we got length: \n");
    270257  for(int i = 0; i < 3; ++i)
    271     printf("length[%i] = %f\n", i, halfLength[i]);
     258    printf("length[%i] = %f\n", i, box->halfLength[i]);
    272259}
    273260
     
    314301  glColor3f(0.0, 0.4, 0.3);
    315302  glVertex3f(this->bvElement->center->x, this->bvElement->center->y, this->bvElement->center->z);
    316   glVertex3f(this->bvElement->axis[0]->x * this->bvElement->halfLength[0], this->bvElement->axis[0]->y * this->bvElement->halfLength[0], this->bvElement->axis[0]->z * this->bvElement->halfLength[0]);
    317 
     303  glVertex3f(this->bvElement->center->x + this->bvElement->axis[0]->x * this->bvElement->halfLength[0],
     304             this->bvElement->center->y + this->bvElement->axis[0]->y * this->bvElement->halfLength[0],
     305             this->bvElement->center->z + this->bvElement->axis[0]->z * this->bvElement->halfLength[0]);
     306/*
     307  printf("from center: %f, %f, %f\n", this->bvElement->center->x, this->bvElement->center->y, this->bvElement->center->z);
     308  printf("to: %f, %f, %f\n\n", this->bvElement->axis[0]->x * this->bvElement->halfLength[0], this->bvElement->axis[0]->y * this->bvElement->halfLength[0], this->bvElement->axis[0]->z * this->bvElement->halfLength[0]);*/
     309 
    318310  glVertex3f(this->bvElement->center->x, this->bvElement->center->y, this->bvElement->center->z);
    319   glVertex3f(this->bvElement->axis[1]->x * this->bvElement->halfLength[1], this->bvElement->axis[1]->y * this->bvElement->halfLength[1], this->bvElement->axis[1]->z * this->bvElement->halfLength[1]);
     311  glVertex3f(this->bvElement->center->x + this->bvElement->axis[1]->x * this->bvElement->halfLength[1],
     312             this->bvElement->center->y + this->bvElement->axis[1]->y * this->bvElement->halfLength[1],
     313             this->bvElement->center->z + this->bvElement->axis[1]->z * this->bvElement->halfLength[1]);
    320314
    321315  glVertex3f(this->bvElement->center->x, this->bvElement->center->y, this->bvElement->center->z);
    322   glVertex3f(this->bvElement->axis[2]->x * this->bvElement->halfLength[2], this->bvElement->axis[2]->y * this->bvElement->halfLength[2], this->bvElement->axis[2]->z * this->bvElement->halfLength[2]);
     316  glVertex3f(this->bvElement->center->x + this->bvElement->axis[2]->x * this->bvElement->halfLength[2],
     317             this->bvElement->center->y + this->bvElement->axis[2]->y * this->bvElement->halfLength[2],
     318             this->bvElement->center->z + this->bvElement->axis[2]->z * this->bvElement->halfLength[2]);
    323319 
    324320  glEnd();
Note: See TracChangeset for help on using the changeset viewer.