Panda3D
 All Classes Functions Variables Enumerations
linearRandomForce.cxx
1 // Filename: linearRandomForce.cxx
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 #include "linearRandomForce.h"
16 
17 TypeHandle LinearRandomForce::_type_handle;
18 
19 ////////////////////////////////////////////////////////////////////
20 // Function : LinearRandomForce
21 // Access : Protected
22 // Description : vector constructor
23 ////////////////////////////////////////////////////////////////////
24 LinearRandomForce::
25 LinearRandomForce(PN_stdfloat a, bool mass) :
26  LinearForce(a, mass) {
27 }
28 
29 ////////////////////////////////////////////////////////////////////
30 // Function : LinearRandomForce
31 // Access : Protected
32 // Description : copy constructor
33 ////////////////////////////////////////////////////////////////////
34 LinearRandomForce::
35 LinearRandomForce(const LinearRandomForce &copy) :
36  LinearForce(copy) {
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function : ~LinearRandomForce
41 // Access : public
42 // Description : destructor
43 ////////////////////////////////////////////////////////////////////
46 }
47 
48 ////////////////////////////////////////////////////////////////////
49 // Function : bounded_rand
50 // Access : Protected
51 // Description : Returns a float in [0, 1]
52 ////////////////////////////////////////////////////////////////////
53 PN_stdfloat LinearRandomForce::
54 bounded_rand() {
55  return ((PN_stdfloat)rand() / (PN_stdfloat)RAND_MAX);
56 }
57 
58 ////////////////////////////////////////////////////////////////////
59 // Function : output
60 // Access : Public
61 // Description : Write a string representation of this instance to
62 // <out>.
63 ////////////////////////////////////////////////////////////////////
65 output(ostream &out) const {
66  #ifndef NDEBUG //[
67  out<<"LinearRandomForce";
68  #endif //] NDEBUG
69 }
70 
71 ////////////////////////////////////////////////////////////////////
72 // Function : write
73 // Access : Public
74 // Description : Write a string representation of this instance to
75 // <out>.
76 ////////////////////////////////////////////////////////////////////
78 write(ostream &out, unsigned int indent) const {
79  #ifndef NDEBUG //[
80  out.width(indent); out<<""; out<<"LinearRandomForce:\n";
81  LinearForce::write(out, indent+2);
82  #endif //] NDEBUG
83 }
Pure virtual, parent to noiseForce and jitterForce.
virtual void write(ostream &out, unsigned int indent=0) const
Write a string representation of this instance to &lt;out&gt;.
virtual void write(ostream &out, unsigned int indent=0) const
Write a string representation of this instance to &lt;out&gt;.
virtual void output(ostream &out) const
Write a string representation of this instance to &lt;out&gt;.
A force that acts on a PhysicsObject by way of an Integrator.
Definition: linearForce.h:25
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
virtual ~LinearRandomForce()
destructor