Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

gravitation.cc

Go to the documentation of this file.
00001 #include "gravitation.hh"
00002 #include "register.hh"
00003 #include "abstractworld.hh"
00004 #include "mass.hh"
00005 #include "element.hh"
00006 
00007 namespace anoid {
00008     namespace plugin {
00009 
00010         using namespace simple;
00011         using namespace base;
00012 
00013         Vector Gravitation::getForce() {
00014             return O;
00015         }
00016 
00017         Vector Gravitation::getApplicationPoint() {
00018             AbstractWorld *w = getWorld();
00019             vector<Element*>::iterator i;
00020             return O;
00021             /*      oMass *m2 = static_cast<oMass *>(a); // Dette kan ikke fejle hvis input er lovligt
00022                     double b = m2->getMass(); Should we care if mass = 0 ?
00023                     if (b != 0) {*/
00024             /*          for (i = w->beginE(); i != w->endE(); ++i) {
00025                         oElement *e = *i;
00026                         if (e && (e != (oElement *) this)) {
00027                         a = e->lookupAbility("Mass");
00028                         if (a) {
00029                         oMass *m1 = static_cast<oMass *>(a);
00030                         a = e->lookupAbility("Position");
00031                         if (a) {
00032                         oPosition *p1 = static_cast<oPosition *>(a);
00033                         Vector f = p1->getPosition() - getPosition();
00034                         double d = f * f;
00035                         if (d != 0) {
00036                         f.setNorm(w->getG() * m1->getMass() / d);
00037                         acceleration += f;
00038                         }
00039                         }
00040                         }
00041                         }
00042                         }*/
00043             //      }
00044         }
00045 
00046         Register(Gravitation)
00047 
00048     };
00049 };

Anoid NG © Michael Westergaard, Martin Stig Stissing, Ronni Michael Laursen, and Kristian Bisgaard Lassen