Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4842 in orxonox.OLD


Ignore:
Timestamp:
Jul 12, 2005, 10:55:44 PM (19 years ago)
Author:
patrick
Message:

orxonox/trunk: calculating dimension of an object. not linking now

Location:
orxonox/trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/src/defs/include_paths.am

    r4758 r4842  
    99AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics
    1010AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics/importer
     11AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/graphics/spatial_separation
    1112AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/particles
    1213AM_CXXFLAGS+=-I$(MAINSRCDIR)/lib/gui
  • orxonox/trunk/src/lib/graphics/spatial_separation/spatial_separation.cc

    r4841 r4842  
    105105* @param playerModel the model that this measurement is based on
    106106  \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.
    107110 */
    108111Rectangle* SpatialSeparation::getDimension(AbstractModel* playerModel)
    109112{
     113  float            maxX, maxY;                       //!< the maximal coordinates axis
     114  float            minX, minY;                       //!< minimal axis coorindates
     115  const float*     pVertices;                        //!< pointer to the current vertices
    110116
     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    PRINTF(0)("Dimension Informationation: X: min/max %f/%f Y: min/max %f/%f\n", minX, maxX, minY, maxY);
     134  }
    111135}
    112136
    113137
    114138
     139
     140
     141
     142
     143
     144
     145
     146
     147
     148
     149
     150
     151
     152
     153
     154
     155
     156
  • orxonox/trunk/src/lib/graphics/spatial_separation/spatial_separation.h

    r4841 r4842  
    11/*!
    2     \file spatial_separation.h
    3   *  Definition of the generic spatial separation process of model data
    4 
     2    \file spatial_separation.h  Definition of the generic spatial separation process of model data
    53 */
    64
     
    4038    Vector center;
    4139    float axis[2];
     40};
    4241
    43 };
    4442
    4543//! A class for spatial separation of vertices based arrays
  • orxonox/trunk/src/world_entities/terrain.cc

    r4836 r4842  
    2424#include "load_param.h"
    2525
     26#include "spatial_separation.h"
     27
    2628using namespace std;
    2729
     
    8385{
    8486  this->setClassID(CL_TERRAIN, "Terrain");
     87
     88  SpatialSeparation* ssp = new SpatialSeparation((AbstractModel*)this->model, 10.0f);
     89
     90
    8591
    8692  this->objectList = 0;
Note: See TracChangeset for help on using the changeset viewer.