00001 // Filename: linearVectorForce.cxx 00002 // Created by: charles (14Jun00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #include "datagram.h" 00016 #include "datagramIterator.h" 00017 #include "bamReader.h" 00018 #include "bamWriter.h" 00019 00020 #include "linearVectorForce.h" 00021 00022 TypeHandle LinearVectorForce::_type_handle; 00023 00024 //////////////////////////////////////////////////////////////////// 00025 // Function : LinearVectorForce 00026 // Access : Public 00027 // Description : Vector Constructor 00028 //////////////////////////////////////////////////////////////////// 00029 LinearVectorForce:: 00030 LinearVectorForce(const LVector3& vec, PN_stdfloat a, bool mass) : 00031 LinearForce(a, mass), 00032 _fvec(vec) { 00033 } 00034 00035 //////////////////////////////////////////////////////////////////// 00036 // Function : LinearVectorForce 00037 // Access : Public 00038 // Description : Default/Piecewise constructor 00039 //////////////////////////////////////////////////////////////////// 00040 LinearVectorForce:: 00041 LinearVectorForce(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z, PN_stdfloat a, bool mass) : 00042 LinearForce(a, mass) { 00043 _fvec.set(x, y, z); 00044 } 00045 00046 //////////////////////////////////////////////////////////////////// 00047 // Function : LinearVectorForce 00048 // Access : Public 00049 // Description : Copy Constructor 00050 //////////////////////////////////////////////////////////////////// 00051 LinearVectorForce:: 00052 LinearVectorForce(const LinearVectorForce ©) : 00053 LinearForce(copy) { 00054 _fvec = copy._fvec; 00055 } 00056 00057 //////////////////////////////////////////////////////////////////// 00058 // Function : LinearVectorForce 00059 // Access : Public 00060 // Description : Destructor 00061 //////////////////////////////////////////////////////////////////// 00062 LinearVectorForce:: 00063 ~LinearVectorForce() { 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function : make_copy 00068 // Access : Public, virtual 00069 // Description : copier 00070 //////////////////////////////////////////////////////////////////// 00071 LinearForce *LinearVectorForce:: 00072 make_copy() { 00073 return new LinearVectorForce(*this); 00074 } 00075 00076 //////////////////////////////////////////////////////////////////// 00077 // Function : get_child_vector 00078 // Access : Public 00079 // Description : vector access 00080 //////////////////////////////////////////////////////////////////// 00081 LVector3 LinearVectorForce:: 00082 get_child_vector(const PhysicsObject *) { 00083 return _fvec; 00084 } 00085 00086 //////////////////////////////////////////////////////////////////// 00087 // Function : output 00088 // Access : Public 00089 // Description : Write a string representation of this instance to 00090 // <out>. 00091 //////////////////////////////////////////////////////////////////// 00092 void LinearVectorForce:: 00093 output(ostream &out) const { 00094 #ifndef NDEBUG //[ 00095 out<<"LinearVectorForce"; 00096 #endif //] NDEBUG 00097 } 00098 00099 //////////////////////////////////////////////////////////////////// 00100 // Function : write 00101 // Access : Public 00102 // Description : Write a string representation of this instance to 00103 // <out>. 00104 //////////////////////////////////////////////////////////////////// 00105 void LinearVectorForce:: 00106 write(ostream &out, unsigned int indent) const { 00107 #ifndef NDEBUG //[ 00108 out.width(indent); out<<""; out<<"LinearVectorForce:\n"; 00109 out.width(indent+2); out<<""; out<<"_fvec "<<_fvec<<"\n"; 00110 LinearForce::write(out, indent+2); 00111 #endif //] NDEBUG 00112 }