Panda3D
linearRandomForce.cxx
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file linearRandomForce.cxx
10  * @author charles
11  * @date 2000-06-19
12  */
13 
14 #include "linearRandomForce.h"
15 
16 TypeHandle LinearRandomForce::_type_handle;
17 
18 /**
19  * vector constructor
20  */
21 LinearRandomForce::
22 LinearRandomForce(PN_stdfloat a, bool mass) :
23  LinearForce(a, mass) {
24 }
25 
26 /**
27  * copy constructor
28  */
29 LinearRandomForce::
30 LinearRandomForce(const LinearRandomForce &copy) :
31  LinearForce(copy) {
32 }
33 
34 /**
35  * destructor
36  */
39 }
40 
41 /**
42  * Returns a float in [0, 1]
43  */
44 PN_stdfloat LinearRandomForce::
45 bounded_rand() {
46  return ((PN_stdfloat)rand() / (PN_stdfloat)RAND_MAX);
47 }
48 
49 /**
50  * Write a string representation of this instance to <out>.
51  */
53 output(std::ostream &out) const {
54  #ifndef NDEBUG //[
55  out<<"LinearRandomForce";
56  #endif //] NDEBUG
57 }
58 
59 /**
60  * Write a string representation of this instance to <out>.
61  */
63 write(std::ostream &out, int indent) const {
64  #ifndef NDEBUG //[
65  out.width(indent); out<<""; out<<"LinearRandomForce:\n";
66  LinearForce::write(out, indent+2);
67  #endif //] NDEBUG
68 }
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
Pure virtual, parent to noiseForce and jitterForce.
A force that acts on a PhysicsObject by way of an Integrator.
Definition: linearForce.h:23
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition: indent.cxx:20
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
Definition: linearForce.cxx:95
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
virtual ~LinearRandomForce()
destructor
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.