Panda3D
 All Classes Functions Variables Enumerations
linearVectorForce.cxx
1 // Filename: linearVectorForce.cxx
2 // Created by: charles (14Jun00)
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 "datagram.h"
16 #include "datagramIterator.h"
17 #include "bamReader.h"
18 #include "bamWriter.h"
19 
20 #include "linearVectorForce.h"
21 
22 TypeHandle LinearVectorForce::_type_handle;
23 
24 ////////////////////////////////////////////////////////////////////
25 // Function : LinearVectorForce
26 // Access : Public
27 // Description : Vector Constructor
28 ////////////////////////////////////////////////////////////////////
30 LinearVectorForce(const LVector3& vec, PN_stdfloat a, bool mass) :
31  LinearForce(a, mass),
32  _fvec(vec) {
33 }
34 
35 ////////////////////////////////////////////////////////////////////
36 // Function : LinearVectorForce
37 // Access : Public
38 // Description : Default/Piecewise constructor
39 ////////////////////////////////////////////////////////////////////
41 LinearVectorForce(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat a, bool mass) :
42  LinearForce(a, mass) {
43  _fvec.set(x, y, z);
44 }
45 
46 ////////////////////////////////////////////////////////////////////
47 // Function : LinearVectorForce
48 // Access : Public
49 // Description : Copy Constructor
50 ////////////////////////////////////////////////////////////////////
53  LinearForce(copy) {
54  _fvec = copy._fvec;
55 }
56 
57 ////////////////////////////////////////////////////////////////////
58 // Function : LinearVectorForce
59 // Access : Public
60 // Description : Destructor
61 ////////////////////////////////////////////////////////////////////
64 }
65 
66 ////////////////////////////////////////////////////////////////////
67 // Function : make_copy
68 // Access : Public, virtual
69 // Description : copier
70 ////////////////////////////////////////////////////////////////////
71 LinearForce *LinearVectorForce::
72 make_copy() {
73  return new LinearVectorForce(*this);
74 }
75 
76 ////////////////////////////////////////////////////////////////////
77 // Function : get_child_vector
78 // Access : Public
79 // Description : vector access
80 ////////////////////////////////////////////////////////////////////
81 LVector3 LinearVectorForce::
82 get_child_vector(const PhysicsObject *) {
83  return _fvec;
84 }
85 
86 ////////////////////////////////////////////////////////////////////
87 // Function : output
88 // Access : Public
89 // Description : Write a string representation of this instance to
90 // <out>.
91 ////////////////////////////////////////////////////////////////////
93 output(ostream &out) const {
94  #ifndef NDEBUG //[
95  out<<"LinearVectorForce";
96  #endif //] NDEBUG
97 }
98 
99 ////////////////////////////////////////////////////////////////////
100 // Function : write
101 // Access : Public
102 // Description : Write a string representation of this instance to
103 // <out>.
104 ////////////////////////////////////////////////////////////////////
106 write(ostream &out, unsigned int indent) const {
107  #ifndef NDEBUG //[
108  out.width(indent); out<<""; out<<"LinearVectorForce:\n";
109  out.width(indent+2); out<<""; out<<"_fvec "<<_fvec<<"\n";
110  LinearForce::write(out, indent+2);
111  #endif //] NDEBUG
112 }
Simple directed vector force.
virtual ~LinearVectorForce()
Destructor.
virtual void write(ostream &out, unsigned int indent=0) const
Write a string representation of this instance to &lt;out&gt;.
A body on which physics will be applied.
Definition: physicsObject.h:29
LinearVectorForce(const LVector3 &vec, PN_stdfloat a=1.0f, bool mass=false)
Vector Constructor.
virtual void output(ostream &out) const
Write a string representation of this instance to &lt;out&gt;.
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 &lt;out&gt;.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85