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 */
26 LinearVectorForce::
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 */
35 LinearVectorForce::
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 */
44 LinearVectorForce::
45 LinearVectorForce(const LinearVectorForce &copy) :
46 LinearForce(copy) {
47 _fvec = copy._fvec;
48 }
49
50 /**
51 * Destructor
52 */
53 LinearVectorForce::
54 ~LinearVectorForce() {
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 */
76 void LinearVectorForce::
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 */
86 void LinearVectorForce::
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 }
bamReader.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bamWriter.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
LinearForce
A force that acts on a PhysicsObject by way of an Integrator.
Definition: linearForce.h:23
LinearForce::write
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
Definition: linearForce.cxx:95
LinearVectorForce
Simple directed vector force.
Definition: linearVectorForce.h:23
LinearVectorForce::LinearVectorForce
LinearVectorForce(const LVector3 &vec, PN_stdfloat a=1.0f, bool mass=false)
Vector Constructor.
Definition: linearVectorForce.cxx:27
LinearVectorForce::~LinearVectorForce
virtual ~LinearVectorForce()
Destructor.
Definition: linearVectorForce.cxx:54
LinearVectorForce::output
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
Definition: linearVectorForce.cxx:77
LinearVectorForce::write
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
Definition: linearVectorForce.cxx:87
PhysicsObject
A body on which physics will be applied.
Definition: physicsObject.h:27
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
datagramIterator.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
datagram.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
indent
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition: indent.cxx:20
linearVectorForce.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.