Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 22, 2005, 2:26:46 AM (18 years ago)
Author:
bensch
Message:

orxonox/branches/collision_detection: switched from pointers to Values, to save debug-time deleting all the nice little new Pointer-arrays

@patrick: hope you approve

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/collision_detection/src/lib/collision_detection/obb_tree_node.cc

    r5694 r5699  
    5050  this->nodeRight = NULL;
    5151  this->bvElement = NULL;
     52  this->tmpVert1 = NULL;
     53  this->tmpVert2 = NULL;
    5254
    5355  if( OBBTreeNode::coMat == NULL)
     
    9395    delete this->bvElement;
    9496  this->bvElement = NULL;
     97
     98  if (this->tmpVert1 != NULL)
     99    delete this->tmpVert1;
     100  if (this->tmpVert2 != NULL)
     101    delete this->tmpVert2;
    95102}
    96103
     
    426433  vectors
    427434  */
    428   Vector*              axis = new Vector[3];                //!< the references to the obb axis
     435  Vector axis[3];                //!< the references to the obb axis
    429436
    430437  Matrix covMat(  box->covarianceMatrix  );
     
    454461  axis[1].normalize();
    455462  axis[2].normalize();*/
    456   box->axis = axis;
     463  box->axis[0] = axis[0];
     464  box->axis[1] = axis[1];
     465  box->axis[2] = axis[2];
    457466
    458467//   PRINTF(0)("-- Got Axis\n");
     
    476485  /* now get the axis length */
    477486  Line                ax[3];                                 //!< the axis
    478   float*              halfLength = new float[3];             //!< half length of the axis
     487  float               halfLength[3];                         //!< half length of the axis
    479488  float               tmpLength;                             //!< tmp save point for the length
    480   Plane               p0(box->axis[0], *box->center);       //!< the axis planes
     489  Plane               p0(box->axis[0], *box->center);        //!< the axis planes
    481490  Plane               p1(box->axis[1], *box->center);
    482491  Plane               p2(box->axis[2], *box->center);
     
    561570
    562571
    563   box->halfLength = halfLength;
     572  box->halfLength[0] = halfLength[0];
     573  box->halfLength[1] = halfLength[1];
     574  box->halfLength[2] = halfLength[2];
    564575  PRINTF(3)("-- Written Axis to obb\n");
    565576  PRINTF(3)("-- Finished Calculating Attributes\n");
     
    620631
    621632  PRINTF(3)("vertex index: %i, of %i\n", vertexIndex, box->numOfVertices);
    622   this->separationPlane = new Plane(box->axis[axisIndex], box->vertices[vertexIndex]);  //!< separation plane
     633  this->separationPlane = Plane(box->axis[axisIndex], box->vertices[vertexIndex]);  //!< separation plane
    623634  this->sepPlaneCenter = &box->vertices[vertexIndex];
    624635  this->longestAxisIndex = axisIndex;
     
    627638  {
    628639    if( i == vertexIndex) continue;
    629     tmpDist = this->separationPlane->distancePoint(box->vertices[i]);
     640    tmpDist = this->separationPlane.distancePoint(box->vertices[i]);
    630641    if( tmpDist > 0.0)
    631642      partition1.add(&box->vertices[i]); /* positive numbers plus zero */
     
    660671    element = iterator->nextElement();
    661672  }
    662 
     673  delete iterator;
    663674//   PRINTF(0)("\npartition 1:\n");
    664675//   for(int i = 0; i < partition1.getSize(); ++i)
     
    679690  }
    680691
     692  if (this->tmpVert1 != NULL)
     693    delete[] this->tmpVert1;
    681694  this->tmpVert1 = vertList1;
     695  if (this->tmpVert2 != NULL)
     696    delete[] this->tmpVert2;
    682697  this->tmpVert2 = vertList2;
    683698  this->tmpLen1 = partition1.getSize();
Note: See TracChangeset for help on using the changeset viewer.