Panda3D
linearVectorForce.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 linearVectorForce.cxx
10  * @author charles
11  * @date 2000-06-14
12  */
13 
14 #include "datagram.h"
15 #include "datagramIterator.h"
16 #include "bamReader.h"
17 #include "bamWriter.h"
18 
19 #include "linearVectorForce.h"
20 
21 TypeHandle LinearVectorForce::_type_handle;
22 
23 /**
24  * Vector Constructor
25  */
27 LinearVectorForce(const LVector3& vec, PN_stdfloat a, bool mass) :
28  LinearForce(a, mass),
29  _fvec(vec) {
30 }
31 
32 /**
33  * Default/Piecewise constructor
34  */
36 LinearVectorForce(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat a, bool mass) :
37  LinearForce(a, mass) {
38  _fvec.set(x, y, z);
39 }
40 
41 /**
42  * Copy Constructor
43  */
46  LinearForce(copy) {
47  _fvec = copy._fvec;
48 }
49 
50 /**
51  * Destructor
52  */
55 }
56 
57 /**
58  * copier
59  */
60 LinearForce *LinearVectorForce::
61 make_copy() {
62  return new LinearVectorForce(*this);
63 }
64 
65 /**
66  * vector access
67  */
68 LVector3 LinearVectorForce::
69 get_child_vector(const PhysicsObject *) {
70  return _fvec;
71 }
72 
73 /**
74  * Write a string representation of this instance to <out>.
75  */
77 output(std::ostream &out) const {
78  #ifndef NDEBUG //[
79  out<<"LinearVectorForce";
80  #endif //] NDEBUG
81 }
82 
83 /**
84  * Write a string representation of this instance to <out>.
85  */
87 write(std::ostream &out, int indent) const {
88  #ifndef NDEBUG //[
89  out.width(indent); out<<""; out<<"LinearVectorForce:\n";
90  out.width(indent+2); out<<""; out<<"_fvec "<<_fvec<<"\n";
91  LinearForce::write(out, indent+2);
92  #endif //] NDEBUG
93 }
Simple directed vector force.
virtual ~LinearVectorForce()
Destructor.
A body on which physics will be applied.
Definition: physicsObject.h:27
LinearVectorForce(const LVector3 &vec, PN_stdfloat a=1.0f, bool mass=false)
Vector Constructor.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A force that acts on a PhysicsObject by way of an Integrator.
Definition: linearForce.h:23
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
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.
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.