Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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


Ignore:
Timestamp:
Jun 13, 2005, 12:39:21 AM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: partition into two diffrent lists works now

File:
1 edited

Legend:

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

    r4612 r4613  
    311311      partition2.add(&box->vertices[i]);
    312312  }
    313   partition2.add(&box->vertices[vertexIndex]);
     313  partition1.add(&box->vertices[vertexIndex]);
    314314
    315315  printf("\npartition1: got %i vertices/ partition 2: got %i vertices\n", partition1.getSize(), partition2.getSize());
     316
     317
     318  /* now comes the separation into two different sVec3D arrays */
     319  tIterator<sVec3D>* iterator;                             //!< the iterator to go through the lists
     320  sVec3D*            element;                              //!< the elements
     321  int                index;                                //!< index storage place
     322  sVec3D*            vertList1;                            //!< the vertex list 1
     323  sVec3D*            vertList2;                            //!< the vertex list 2
     324
     325  vertList1 = new sVec3D[partition1.getSize()];
     326  vertList2 = new sVec3D[partition2.getSize()];
     327
     328  iterator = partition1.getIterator();
     329  element = iterator->nextElement();
     330  index = 0;
     331  while( element != NULL)
     332  {
     333    vertList1[index][0] = element[0][0];
     334    vertList1[index][1] = element[0][1];
     335    vertList1[index][2] = element[0][2];
     336    ++index;
     337    element = iterator->nextElement();
     338  }
     339
     340  printf("\npartition 1:\n");
     341  for(int i = 0; i < partition1.getSize(); ++i)
     342  {
     343    printf("v[%i][0] = %f\n", i, vertList1[i][0]);
     344    printf("v[%i][1] = %f\n", i, vertList1[i][1]);
     345    printf("v[%i][2] = %f\n", i, vertList1[i][2]);
     346  }
     347
     348  iterator = partition2.getIterator();
     349  element = iterator->nextElement();
     350  index = 0;
     351  while( element != NULL)
     352  {
     353    vertList2[index][0] = element[0][0];
     354    vertList2[index][1] = element[0][1];
     355    vertList2[index][2] = element[0][2];
     356    ++index;
     357    element = iterator->nextElement();
     358  }
     359
     360  printf("\npartition 2:\n");
     361  for(int i = 0; i < partition2.getSize(); ++i)
     362  {
     363    printf("v[%i][0] = %f\n", i, vertList2[i][0]);
     364    printf("v[%i][1] = %f\n", i, vertList2[i][1]);
     365    printf("v[%i][2] = %f\n", i, vertList2[i][2]);
     366  }
    316367
    317368}
Note: See TracChangeset for help on using the changeset viewer.