Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 12, 2005, 11:48:39 PM (20 years ago)
Author:
patrick
Message:

orxonox/trunk: added the rectangle to the vector file, since it is a geometrical body like a plane (the plane without arrows…), moved getDimension function to the QuadtreeNode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/lib/graphics/spatial_separation/spatial_separation.cc

    r4844 r4845  
    3434{
    3535   this->setClassID(CL_SPATIAL_SEPARATION, "SpatialSeparation");
    36    this->getDimension(model);
     36   this->createQuadtree(model);
    3737}
    3838
     
    9797  this->quadtree->separate();
    9898
     99
    99100  return this->quadtree;
    100 }
    101 
    102 
    103 /**
    104   \brief gets the maximal dimension of a model
    105 * @param playerModel the model that this measurement is based on
    106   \return the dimension of the AbstractModel as a Rectangle
    107 
    108   The rectangle is x-z axis aligned. ATTENTION: if there are any vertices in the model, that exceed the
    109   size of 999999.0, there probably will be some errors in the dimensions calculations.
    110  */
    111 Rectangle* SpatialSeparation::getDimension(AbstractModel* playerModel)
    112 {
    113   float            maxX, maxY;                       //!< the maximal coordinates axis
    114   float            minX, minY;                       //!< minimal axis coorindates
    115   const float*     pVertices;                        //!< pointer to the current vertices
    116 
    117   maxX = -999999; maxY = -999999;
    118   minX =  999999; minY =  999999;
    119   /* get maximal/minimal x/y */
    120   for( int i = 0; i < playerModel->getModelInfo()->numVertices; ++i)
    121   {
    122     pVertices = &playerModel->getModelInfo()->pVertices[i * 3];
    123     if( pVertices[0] > maxX)
    124       maxX = pVertices[0];
    125     if( pVertices[2] > maxY)
    126       maxY = pVertices[2];
    127 
    128     if( pVertices[0] < minX)
    129       minX = pVertices[0];
    130     if( pVertices[2] < minY)
    131       minY = pVertices[2];
    132   }
    133   Rectangle* rect = new Rectangle();
    134 
    135   rect->setCenter((maxX + minX) / 2.0f, 0.0f, (maxY + minY) / 2.0f);
    136 
    137 
    138   PRINTF(0)("Dimension Informationation: X: min/max %f/%f Y: min/max %f/%f\n", minX, maxX, minY, maxY);
    139101}
    140102
Note: See TracChangeset for help on using the changeset viewer.