Panda3D
linearDistanceForce.cxx
1 // Filename: linearDistanceForce.cxx
2 // Created by: charles (21Jun00)
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 "linearDistanceForce.h"
16 
17 TypeHandle LinearDistanceForce::_type_handle;
18 
19 ////////////////////////////////////////////////////////////////////
20 // Function : LinearDistanceForce
21 // Access : Protected
22 // Description : Simple constructor
23 ////////////////////////////////////////////////////////////////////
24 LinearDistanceForce::
25 LinearDistanceForce(const LPoint3& p, FalloffType ft, PN_stdfloat r, PN_stdfloat a, bool m) :
26  LinearForce(a, m),
27  _force_center(p), _falloff(ft), _radius(r)
28 {
29 }
30 
31 ////////////////////////////////////////////////////////////////////
32 // Function : LinearDistanceForce
33 // Access : Protected
34 // Description : copy constructor
35 ////////////////////////////////////////////////////////////////////
36 LinearDistanceForce::
37 LinearDistanceForce(const LinearDistanceForce &copy) :
38  LinearForce(copy) {
39  _falloff = copy._falloff;
40  _radius = copy._radius;
41  _force_center = copy._force_center;
42 }
43 
44 ////////////////////////////////////////////////////////////////////
45 // Function : ~LinearDistanceForce
46 // Access : Protected
47 // Description : destructor
48 ////////////////////////////////////////////////////////////////////
49 LinearDistanceForce::
50 ~LinearDistanceForce() {
51 }
52 
53 ////////////////////////////////////////////////////////////////////
54 // Function : output
55 // Access : Public
56 // Description : Write a string representation of this instance to
57 // <out>.
58 ////////////////////////////////////////////////////////////////////
60 output(ostream &out) const {
61  #ifndef NDEBUG //[
62  out<<"LinearDistanceForce";
63  #endif //] NDEBUG
64 }
65 
66 ////////////////////////////////////////////////////////////////////
67 // Function : write
68 // Access : Public
69 // Description : Write a string representation of this instance to
70 // <out>.
71 ////////////////////////////////////////////////////////////////////
73 write(ostream &out, unsigned int indent) const {
74  #ifndef NDEBUG //[
75  out.width(indent); out<<""; out<<"LinearDistanceForce:\n";
76  out.width(indent+2); out<<""; out<<"_force_center "<<_force_center<<"\n";
77  out.width(indent+2); out<<""; out<<"_falloff "<<_falloff<<"\n";
78  out.width(indent+2); out<<""; out<<"_radius "<<_radius<<"\n";
79  LinearForce::write(out, indent+2);
80  #endif //] NDEBUG
81 }
Pure virtual class for sinks and sources.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
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>.
virtual void output(ostream &out) const
Write a string representation of this instance to <out>.
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