00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef LINEARDISTANCEFORCE_H
00016 #define LINEARDISTANCEFORCE_H
00017
00018 #include "linearForce.h"
00019
00020 class BamReader;
00021
00022
00023
00024
00025
00026 class EXPCL_PANDAPHYSICS LinearDistanceForce : public LinearForce {
00027 PUBLISHED:
00028 enum FalloffType {
00029 FT_ONE_OVER_R,
00030 FT_ONE_OVER_R_SQUARED,
00031 FT_ONE_OVER_R_CUBED
00032 };
00033
00034 INLINE void set_radius(PN_stdfloat r);
00035 INLINE void set_falloff_type(FalloffType ft);
00036 INLINE void set_force_center(const LPoint3& p);
00037
00038 INLINE PN_stdfloat get_radius() const;
00039 INLINE FalloffType get_falloff_type() const;
00040 INLINE LPoint3 get_force_center() const;
00041
00042 INLINE PN_stdfloat get_scalar_term() const;
00043
00044 virtual void output(ostream &out) const;
00045 virtual void write(ostream &out, unsigned int indent=0) const;
00046
00047 private:
00048 LPoint3 _force_center;
00049
00050 FalloffType _falloff;
00051 PN_stdfloat _radius;
00052
00053 virtual LinearForce *make_copy() = 0;
00054 virtual LVector3 get_child_vector(const PhysicsObject *po) = 0;
00055
00056 protected:
00057 LinearDistanceForce(const LPoint3& p, FalloffType ft, PN_stdfloat r, PN_stdfloat a,
00058 bool m);
00059 LinearDistanceForce(const LinearDistanceForce ©);
00060 virtual ~LinearDistanceForce();
00061
00062 public:
00063 static TypeHandle get_class_type() {
00064 return _type_handle;
00065 }
00066 static void init_type() {
00067 LinearForce::init_type();
00068 register_type(_type_handle, "LinearDistanceForce",
00069 LinearForce::get_class_type());
00070 }
00071 virtual TypeHandle get_type() const {
00072 return get_class_type();
00073 }
00074 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00075
00076 private:
00077 static TypeHandle _type_handle;
00078 };
00079
00080 #include "linearDistanceForce.I"
00081
00082 #endif // LINEARDISTANCEFORCE_H