Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

panda/src/physics/linearDistanceForce.h

Go to the documentation of this file.
00001 // Filename: linearDistanceForce.h
00002 // Created by:  charles (21Jun00)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) 2001, Disney Enterprises, Inc.  All rights reserved
00008 //
00009 // All use of this software is subject to the terms of the Panda 3d
00010 // Software license.  You should have received a copy of this license
00011 // along with this source code; you will also find a current copy of
00012 // the license at http://www.panda3d.org/license.txt .
00013 //
00014 // To contact the maintainers of this program write to
00015 // panda3d@yahoogroups.com .
00016 //
00017 ////////////////////////////////////////////////////////////////////
00018 
00019 #ifndef LINEARDISTANCEFORCE_H
00020 #define LINEARDISTANCEFORCE_H
00021 
00022 #include "linearForce.h"
00023 
00024 class BamReader;
00025 
00026 ////////////////////////////////////////////////////////////////////
00027 //       Class : LinearDistanceForce
00028 // Description : Pure virtual class for sinks and sources
00029 ////////////////////////////////////////////////////////////////////
00030 class EXPCL_PANDAPHYSICS LinearDistanceForce : public LinearForce {
00031 PUBLISHED:
00032   enum FalloffType {
00033     FT_ONE_OVER_R,
00034     FT_ONE_OVER_R_SQUARED,
00035     FT_ONE_OVER_R_CUBED
00036   };
00037 
00038   INLINE void set_radius(float r);
00039   INLINE void set_falloff_type(FalloffType ft);
00040   INLINE void set_force_center(const LPoint3f& p);
00041 
00042   INLINE float get_radius(void) const;
00043   INLINE FalloffType get_falloff_type(void) const;
00044   INLINE LPoint3f get_force_center(void) const;
00045 
00046   INLINE float get_scalar_term(void) const;
00047 
00048 private:
00049   LPoint3f _force_center;
00050 
00051   FalloffType _falloff;
00052   float _radius;
00053 
00054   virtual LinearForce *make_copy(void) = 0;
00055   virtual LVector3f get_child_vector(const PhysicsObject *po) = 0;
00056 
00057 protected:
00058   LinearDistanceForce(const LPoint3f& p, FalloffType ft, float r, float a,
00059                 bool m);
00060   LinearDistanceForce(const LinearDistanceForce &copy);
00061   virtual ~LinearDistanceForce(void);
00062 
00063 public:
00064   static TypeHandle get_class_type(void) {
00065     return _type_handle;
00066   }
00067   static void init_type(void) {
00068     LinearForce::init_type();
00069     register_type(_type_handle, "LinearDistanceForce",
00070                   LinearForce::get_class_type());
00071   }
00072   virtual TypeHandle get_type(void) const {
00073     return get_class_type();
00074   }
00075   virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00076 
00077 private:
00078   static TypeHandle _type_handle;
00079 };
00080 
00081 #include "linearDistanceForce.I"
00082 
00083 #endif // LINEARDISTANCEFORCE_H

Generated on Fri May 2 00:42:54 2003 for Panda by doxygen1.3