Panda3D
|
00001 // Filename: linearRandomForce.cxx 00002 // Created by: charles (19Jun00) 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 "linearRandomForce.h" 00016 00017 TypeHandle LinearRandomForce::_type_handle; 00018 00019 //////////////////////////////////////////////////////////////////// 00020 // Function : LinearRandomForce 00021 // Access : Protected 00022 // Description : vector constructor 00023 //////////////////////////////////////////////////////////////////// 00024 LinearRandomForce:: 00025 LinearRandomForce(PN_stdfloat a, bool mass) : 00026 LinearForce(a, mass) { 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function : LinearRandomForce 00031 // Access : Protected 00032 // Description : copy constructor 00033 //////////////////////////////////////////////////////////////////// 00034 LinearRandomForce:: 00035 LinearRandomForce(const LinearRandomForce ©) : 00036 LinearForce(copy) { 00037 } 00038 00039 //////////////////////////////////////////////////////////////////// 00040 // Function : ~LinearRandomForce 00041 // Access : public 00042 // Description : destructor 00043 //////////////////////////////////////////////////////////////////// 00044 LinearRandomForce:: 00045 ~LinearRandomForce() { 00046 } 00047 00048 //////////////////////////////////////////////////////////////////// 00049 // Function : bounded_rand 00050 // Access : Protected 00051 // Description : Returns a float in [0, 1] 00052 //////////////////////////////////////////////////////////////////// 00053 PN_stdfloat LinearRandomForce:: 00054 bounded_rand() { 00055 return ((PN_stdfloat)rand() / (PN_stdfloat)RAND_MAX); 00056 } 00057 00058 //////////////////////////////////////////////////////////////////// 00059 // Function : output 00060 // Access : Public 00061 // Description : Write a string representation of this instance to 00062 // <out>. 00063 //////////////////////////////////////////////////////////////////// 00064 void LinearRandomForce:: 00065 output(ostream &out) const { 00066 #ifndef NDEBUG //[ 00067 out<<"LinearRandomForce"; 00068 #endif //] NDEBUG 00069 } 00070 00071 //////////////////////////////////////////////////////////////////// 00072 // Function : write 00073 // Access : Public 00074 // Description : Write a string representation of this instance to 00075 // <out>. 00076 //////////////////////////////////////////////////////////////////// 00077 void LinearRandomForce:: 00078 write(ostream &out, unsigned int indent) const { 00079 #ifndef NDEBUG //[ 00080 out.width(indent); out<<""; out<<"LinearRandomForce:\n"; 00081 LinearForce::write(out, indent+2); 00082 #endif //] NDEBUG 00083 }