Panda3D
linearRandomForce.h
1 // Filename: linearRandomForce.h
2 // Created by: charles (19Jun00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef LINEARRANDOMFORCE_H
16 #define LINEARRANDOMFORCE_H
17 
18 #include <stdlib.h>
19 #include "cmath.h"
20 #include "mathNumbers.h"
21 #include "linearForce.h"
22 
23 ////////////////////////////////////////////////////////////////////
24 // Class : LinearRandomForce
25 // Description : Pure virtual, parent to noiseForce and jitterForce
26 ////////////////////////////////////////////////////////////////////
27 class EXPCL_PANDAPHYSICS LinearRandomForce : public LinearForce {
28 PUBLISHED:
29  virtual ~LinearRandomForce();
30 
31  virtual void output(ostream &out) const;
32  virtual void write(ostream &out, unsigned int indent=0) const;
33 
34 protected:
35  static PN_stdfloat bounded_rand();
36  static LVector3 random_unit_vector();
37 
38  LinearRandomForce(PN_stdfloat a = 1.0f, bool m = false);
40 
41  virtual LVector3 get_child_vector(const PhysicsObject *po) = 0;
42  virtual LinearForce *make_copy() = 0;
43 
44 public:
45  static TypeHandle get_class_type() {
46  return _type_handle;
47  }
48  static void init_type() {
49  LinearForce::init_type();
50  register_type(_type_handle, "LinearRandomForce",
51  LinearForce::get_class_type());
52  }
53  virtual TypeHandle get_type() const {
54  return get_class_type();
55  }
56  virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
57 
58 private:
59  static TypeHandle _type_handle;
60 };
61 
62 #include "linearRandomForce.I"
63 
64 #endif // LINEARRANDOMFORCE_H
Pure virtual, parent to noiseForce and jitterForce.
A body on which physics will be applied.
Definition: physicsObject.h:29
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
A force that acts on a PhysicsObject by way of an Integrator.
Definition: linearForce.h:25
virtual void write(ostream &out, unsigned int indent=0) const
Write a string representation of this instance to <out>.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
virtual void output(ostream &out) const
Write a string representation of this instance to <out>.
Definition: linearForce.cxx:97