Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Nov 26, 2010, 8:44:48 AM (13 years ago)
Author:
dafrick
Message:

Some documentation and simplification

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/modules/objects/ForceField.h

    r7674 r7676  
    3333*/
    3434
    35 /**
    36 @file ForceField.h
    37 @brief Definition of the ForceField class.
    38 @inGroup Objects
    39 */
    40 
    4135#ifndef _ForceField_H__
    4236#define _ForceField_H__
     
    5347    @brief
    5448        The mode of the ForceField.
    55    
    56     @inGroup Objects
     49
     50    @ingroup Objects
    5751    */
    5852    namespace forceFieldMode
     
    6155            tube, //!< The ForceField has a tube shape.
    6256            sphere //!< The ForceField has a spherical shape.
    63            
    6457        };
    6558    }
     
    6861    @brief
    6962        Implements a force field, that applies a force to any @ref orxonox::MoblieEnity "MobileEntity" that enters its range.
    70        
     63
    7164        The following parameters can be set to specify the behavior of the ForceField.
    72         - @b velocity The amount of force the ForceField excerts.
    73         - @b diameter The diameter of the ForceField.
    74         - @b length The length of the ForceField.
     65        - @b velocity The amount of force the ForceField excerts. Default is 100.
     66        - @b diameter The diameter of the ForceField. Default is 500.
     67        - @b length The length of the ForceField. Default is 2000.
    7568        - @b mode The mode the ForceField is in. For mode:
    76         -- <em>tube</em> A ForceField which exerts force only in the direction it is oriented. The force is only exerted on objects that are in a tube of length <em>length</em> and diameter <em>diameter</em>. The magintude of the force is proportional to the <em><velocity/em>, being highest when an object is in the middle of the tube (radius-wise), linearly decreasing with greater radii and finally reaching zero, when the object is <code>diameter/2</code> away from the orientation vector.
    77         -- <em>sphere</em> A Force Field which exerts force radially away from itself, with the greatest magnitude (proportional to <em>velocity</em>) being in the origin of the ForceField, linearly decreasing with respect to the distance to the origin and finally reaching zero at distance <code>diameter/2</code>.
    78        
     69            - <em>tube</em> A ForceField which exerts force only in the direction it is oriented. The force is only exerted on objects that are in a tube of length <em>length</em> and diameter <em>diameter</em>. The magintude of the force is proportional to the <em>velocity</em>, being highest when an object is in the middle of the tube (radius-wise), linearly decreasing with greater radii and finally reaching zero, when the object is <code>diameter/2</code> away from the orientation vector.
     70            - <em>sphere</em> A Force Field which exerts force radially away from itself, with the greatest magnitude (proportional to <em>velocity</em>) being in the origin of the ForceField, linearly decreasing with respect to the distance to the origin and finally reaching zero at distance <code>diameter/2</code>.
     71            Default is <em>tube</em>.
     72
    7973    @author
    8074        Aurelian Jaggi
    81        
     75
    8276    @author
    8377        Damian 'Mozork' Frick
    84        
    85     @inGroup Objects
     78
     79    @ingroup Objects
    8680    */
    8781    class _ObjectsExport ForceField : public StaticEntity, public Tickable
     
    9084            ForceField(BaseObject* creator);
    9185            virtual ~ForceField();
    92             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
    93             virtual void tick(float dt);
    9486
     87            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Creates a ForceField object through XML.
     88            virtual void tick(float dt); //!< A method that is called every tick.
     89
     90            /**
     91            @brief Set the velocity of the ForceField.
     92            @param vel The velocity to be set.
     93            */
    9594            inline void setVelocity(float vel)
    9695                { this->velocity_ = vel; }
    97 
     96            /**
     97            @brief Get the velocity of the ForceField.
     98            @return Returns the velocity of the ForceField.
     99            */
    98100            inline float getVelocity()
    99101                { return this->velocity_; }
    100102
     103            /**
     104            @brief Set the diameter of the ForceField.
     105            @param diam The diameter to be set.
     106            */
    101107            inline void setDiameter(float diam)
    102                 { this->diameter_ = diam; this->radius_ = diam/2; }
     108                { this->radius_ = diam/2; }
     109            /**
     110            @brief Get the diameter of the ForceField.
     111            @return Returns the diameter of the ForceField.
     112            */
     113            inline float getDiameter()
     114                { return this->radius_*2; }
    103115
    104             inline float getDiameter()
    105                 { return this->diameter_; }
     116            /**
     117            @brief Set the length of the ForceField.
     118            @param l The length to be set.
     119            */
     120            inline void setLength(float l)
     121                { this->halfLength_ = l/2; }
     122            /**
     123            @brief Get the length of the ForceField.
     124            @return Returns the length of the ForceField.
     125            */
     126            inline float getLength()
     127                { return this->halfLength_*2; }
    106128
    107             inline void setLength(float l)
    108                 { this->length_ = l; this->halfLength_ = l/2; }
    109 
    110             inline float getLength()
    111                 { return this->length_; }
    112                
    113             void setMode(const std::string& mode);
    114                
    115             inline const std::string& getMode(void);
     129            void setMode(const std::string& mode); //!< Set the mode of the ForceField.
     130            const std::string& getMode(void); //!< Get the mode of the ForceField.
    116131
    117132        private:
     133            //! Strings to represent the modes.
    118134            static const std::string modeTube_s;
    119135            static const std::string modeSphere_s;
    120        
    121             float velocity_;
    122             float diameter_;
    123             float radius_;
    124             float length_;
    125             float halfLength_;
    126             forceFieldMode::Value mode_;
     136
     137            float velocity_; //!< The velocity of the ForceField.
     138            float radius_; //!< The radius of the ForceField.
     139            float halfLength_; //!< Half of the length of the ForceField.
     140            forceFieldMode::Value mode_; //!< The mode of the ForceField.
    127141  };
    128142}
    129143
    130144#endif
    131 
Note: See TracChangeset for help on using the changeset viewer.