Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4180 in orxonox.OLD for orxonox/branches/physics/src/util/physics


Ignore:
Timestamp:
May 13, 2005, 11:57:13 PM (19 years ago)
Author:
bensch
Message:

orxonox/branches/physics: added a simple force; GRAVITY

Location:
orxonox/branches/physics/src/util/physics/fields
Files:
1 added
2 copied
2 moved

Legend:

Unmodified
Added
Removed
  • orxonox/branches/physics/src/util/physics/fields/field.h

    r4179 r4180  
    4242      \returns The Force Vector
    4343  */
    44   virtual Vector& calcForce(Vector& data) = 0;
     44  virtual Vector calcForce(const Vector& data) const = 0;
    4545
    4646  void setMagnitude(const float& magnitude);
    4747  /** \returns The Magnitude of the Field */
    48   const float& getMagnitude(void) const {return this->magnitude;}
     48  inline const float& getMagnitude(void) const {return this->magnitude;}
    4949
    5050  void setAttenuation(const float& attenuation);
    5151  /** \returns The Attenuation of the Fiels */
    52   const float& getAttenuation(void) const {return this->attenuation;}
     52  inline const float& getAttenuation(void) const {return this->attenuation;}
    5353
    5454 private:
  • orxonox/branches/physics/src/util/physics/fields/gravity.cc

    r4178 r4180  
    1616//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
    1717
    18 #include "proto_class.h"
     18#include "gravity.h"
    1919
    2020using namespace std;
     
    2525   \todo this constructor is not jet implemented - do it
    2626*/
    27 ProtoClass::ProtoClass ()
     27Gravity::Gravity ()
    2828{
    29    this->setClassName ("ProtoClass");
     29   this->setClassName ("Gravity");
    3030}
    3131
     
    3535
    3636*/
    37 ProtoClass::~ProtoClass ()
     37Gravity::~Gravity ()
    3838{
    3939  // delete what has to be deleted here
    4040}
     41
     42/**
     43   \brief calculates the Gravity on any point in space
     44   \param data The Position of the Point in space to attache gravity to.
     45   \returns The force.
     46*/
     47Vector Gravity::calcForce(const Vector& data) const
     48{
     49  return /*(this->getAbsDir().apply(Vector(0,1,0)))*/ Vector(0,-1,0) * this->getMagnitude();
     50}
     51
     52
  • orxonox/branches/physics/src/util/physics/fields/gravity.h

    r4178 r4180  
    11/*!
    2     \file proto_class.h
     2    \file gravity.h
    33    \brief Definition of ...
    44
    55*/
    66
    7 #ifndef _PROTO_CLASS_H
    8 #define _PROTO_CLASS_H
     7#ifndef _GRAVITY_H
     8#define _GRAVITY_H
    99
    10 #include "base_object.h"
     10#include "field.h"
    1111
    1212// FORWARD DEFINITION
     
    1515
    1616//! A class for ...
    17 class ProtoClass : public BaseObject {
     17class Gravity : public Field {
    1818
    1919 public:
    20   ProtoClass();
    21   virtual ~ProtoClass();
     20  Gravity();
     21  virtual ~Gravity();
    2222
     23  virtual Vector calcForce(const Vector& data) const;
    2324
    2425 private:
     
    2627};
    2728
    28 #endif /* _PROTO_CLASS_H */
     29#endif /* _GRAVITY_H */
Note: See TracChangeset for help on using the changeset viewer.