Panda3D
 All Classes Functions Variables Enumerations
linearSinkForce.cxx
00001 // Filename: linearSinkForce.cxx
00002 // Created by:  charles (21Jun00)
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 "linearSinkForce.h"
00016 
00017 TypeHandle LinearSinkForce::_type_handle;
00018 
00019 ////////////////////////////////////////////////////////////////////
00020 //    Function : LinearSinkForce
00021 //      Access : Public
00022 // Description : Simple constructor
00023 ////////////////////////////////////////////////////////////////////
00024 LinearSinkForce::
00025 LinearSinkForce(const LPoint3& p, FalloffType f, PN_stdfloat r, PN_stdfloat a,
00026                 bool mass) :
00027   LinearDistanceForce(p, f, r, a, mass) {
00028 }
00029 
00030 ////////////////////////////////////////////////////////////////////
00031 //    Function : LinearSinkForce
00032 //      Access : Public
00033 // Description : Simple constructor
00034 ////////////////////////////////////////////////////////////////////
00035 LinearSinkForce::
00036 LinearSinkForce() :
00037   LinearDistanceForce(LPoint3(0.0f, 0.0f, 0.0f), FT_ONE_OVER_R_SQUARED,
00038                       1.0f, 1.0f, true) {
00039 }
00040 
00041 ////////////////////////////////////////////////////////////////////
00042 //    Function : LinearSinkForce
00043 //      Access : Public
00044 // Description : copy constructor
00045 ////////////////////////////////////////////////////////////////////
00046 LinearSinkForce::
00047 LinearSinkForce(const LinearSinkForce &copy) :
00048   LinearDistanceForce(copy) {
00049 }
00050 
00051 ////////////////////////////////////////////////////////////////////
00052 //    Function : ~LinearSinkForce
00053 //      Access : Public
00054 // Description : Simple destructor
00055 ////////////////////////////////////////////////////////////////////
00056 LinearSinkForce::
00057 ~LinearSinkForce() {
00058 }
00059 
00060 ////////////////////////////////////////////////////////////////////
00061 //    Function : make_copy
00062 //      Access : Public
00063 // Description : copier
00064 ////////////////////////////////////////////////////////////////////
00065 LinearForce *LinearSinkForce::
00066 make_copy() {
00067   return new LinearSinkForce(*this);
00068 }
00069 
00070 ////////////////////////////////////////////////////////////////////
00071 //    Function : get_child_vector
00072 //      Access : Public
00073 // Description : virtual force query
00074 ////////////////////////////////////////////////////////////////////
00075 LVector3 LinearSinkForce::
00076 get_child_vector(const PhysicsObject *po) {
00077   return (get_force_center() - po->get_position()) * get_scalar_term();
00078 }
00079 
00080 ////////////////////////////////////////////////////////////////////
00081 //     Function : output
00082 //       Access : Public
00083 //  Description : Write a string representation of this instance to
00084 //                <out>.
00085 ////////////////////////////////////////////////////////////////////
00086 void LinearSinkForce::
00087 output(ostream &out) const {
00088   #ifndef NDEBUG //[
00089   out<<"LinearSinkForce";
00090   #endif //] NDEBUG
00091 }
00092 
00093 ////////////////////////////////////////////////////////////////////
00094 //     Function : write
00095 //       Access : Public
00096 //  Description : Write a string representation of this instance to
00097 //                <out>.
00098 ////////////////////////////////////////////////////////////////////
00099 void LinearSinkForce::
00100 write(ostream &out, unsigned int indent) const {
00101   #ifndef NDEBUG //[
00102   out.width(indent); out<<""; out<<"LinearSinkForce:\n";
00103   LinearDistanceForce::write(out, indent+2);
00104   #endif //] NDEBUG
00105 }
 All Classes Functions Variables Enumerations