Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 18, 2007, 4:47:58 PM (16 years ago)
Author:
nicolasc
Message:
  • changed comments to doxygen tags in flocking
  • reduced ogre depency in HUD and ParticleInterface
  • various
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/FICN/src/orxonox/Flocking.h

    r609 r618  
    55#define Flocking_Class
    66
    7 #include <Ogre.h>
     7// #include <Ogre.h>
    88#include <OgreVector3.h>
    99
     
    1919
    2020  public:
    21     Ogre::Vector3 location;  // locationvector of the element
    22     Ogre::Vector3 speed;  // speedvector of the element
    23     Ogre::Vector3 acceleration;  // accelerationvector of the element
    24     bool movable;  // movability of the element, (false) gives the possiblity that an object can`t be moved by flocking but still gets into the calculation
    25     static int const SEPERATIONDISTANCE = 300;  //detectionradius of seperation
    26     static int const ALIGNMENTDISTANCE = 300;  //detectionradius of alignment
    27     static int const COHESIONDISTANCE = 5000;  //detectionradius of cohesion
    28     static int const ANZELEMENTS = 9;  //number of elements
     21    Ogre::Vector3 location;                       //!< locationvector of the element
     22    Ogre::Vector3 speed;                          //!< speedvector of the element
     23    Ogre::Vector3 acceleration;                   //!< accelerationvector of the element
     24    bool movable;                                 //!< movability of the element, (false) gives the possiblity that an object can`t be moved by flocking but still gets into the calculation
     25    static int const SEPERATIONDISTANCE = 300;    //!< detectionradius of seperation
     26    static int const ALIGNMENTDISTANCE = 300;     //!< detectionradius of alignment
     27    static int const COHESIONDISTANCE = 5000;     //!< detectionradius of cohesion
     28    static int const ANZELEMENTS = 9;             //!< number of elements
    2929
    30   //default constructor
     30  //! default constructor
    3131  Element() {
    32     acceleration = (0,0,0);
    33     speed = (0,0,0);
    34     location = (0,0,0);
     32    acceleration = Ogre::Vector3(0,0,0);
     33    speed = Ogre::Vector3(0,0,0);
     34    location = Ogre::Vector3(0,0,0);
    3535    movable = true;
    3636  }
    3737
    38   //constructor
     38  /** constructor
     39   *  @param location_ sets locationvector of the element
     40   *  @param speed_ sets speedvector of the element
     41   *  @param acceleration_ sets accelerationvector of the element
     42   *  @param movable_ sets movability of the element
     43   */
    3944  Element(Ogre::Vector3 location_, Ogre::Vector3 speed_, Ogre::Vector3 acceleration_, bool movable_) {
    4045    acceleration = acceleration_;
     
    4449  }
    4550
    46   //function to chance values of an element
     51  //! function to chance values of an element
    4752  void setValues(Ogre::Vector3 location_, Ogre::Vector3 speed_, Ogre::Vector3 acceleration_, bool movable_) {
    4853    acceleration = acceleration_;
     
    5257  }
    5358
    54   //calculates the distance between the element and an other point given by temp
    55   float getDistance(Element temp) {
    56     Ogre::Vector3 distance = temp.location-location;
     59  /** calculates the distance between the element and an other point given by temp
     60   * @param e remote object to calculate distance to
     61   */
     62  float getDistance(Element e) {
     63    Ogre::Vector3 distance = e.location - location;
    5764    return distance.length();
    5865  }
    5966
    60   //updates the data of an element
     67  //! updates the data of an element
    6168  void update(Element arrayOfElements[]) {
    6269    if (this->movable == true) {calculateAcceleration(arrayOfElements);} //if element is movable, calculate acceleration
    6370  }
    6471
    65   //calculates the new acceleration of an element
     72  //! calculates the new acceleration of an element
    6673  void calculateAcceleration(Element arrayOfElements[]) {
    6774    acceleration = separation(arrayOfElements) + alignment(arrayOfElements) + cohesion(arrayOfElements);  //acceleration consisting of flocking-functions
    6875  }
    6976
    70   //separation-function (keep elements separated, avoid crashs)
     77  //! separation-function (keep elements separated, avoid crashs)
    7178  Ogre::Vector3 separation(Element arrayOfElements[]) {
    7279    using namespace Ogre;
     
    94101  }
    95102
    96   //alignment-function (lead elements to the same heading)
     103  //! alignment-function (lead elements to the same heading)
    97104  Ogre::Vector3 alignment(Element arrayOfElements[]) {
    98105    using namespace Ogre;
     
    113120  }
    114121
    115   //cohseion-function (keep elements close to each other)
     122  //! cohseion-function (keep elements close to each other)
    116123  Ogre::Vector3 cohesion(Element arrayOfElements[]) {
    117124    using namespace Ogre;
Note: See TracChangeset for help on using the changeset viewer.