Panda3D
linearSinkForce.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 linearSinkForce.cxx
10  * @author charles
11  * @date 2000-06-21
12  */
13 
14 #include "linearSinkForce.h"
15 
16 TypeHandle LinearSinkForce::_type_handle;
17 
18 /**
19  * Simple constructor
20  */
22 LinearSinkForce(const LPoint3& p, FalloffType f, PN_stdfloat r, PN_stdfloat a,
23  bool mass) :
24  LinearDistanceForce(p, f, r, a, mass) {
25 }
26 
27 /**
28  * Simple constructor
29  */
32  LinearDistanceForce(LPoint3(0.0f, 0.0f, 0.0f), FT_ONE_OVER_R_SQUARED,
33  1.0f, 1.0f, true) {
34 }
35 
36 /**
37  * copy constructor
38  */
41  LinearDistanceForce(copy) {
42 }
43 
44 /**
45  * Simple destructor
46  */
49 }
50 
51 /**
52  * copier
53  */
54 LinearForce *LinearSinkForce::
55 make_copy() {
56  return new LinearSinkForce(*this);
57 }
58 
59 /**
60  * virtual force query
61  */
62 LVector3 LinearSinkForce::
63 get_child_vector(const PhysicsObject *po) {
64  return (get_force_center() - po->get_position()) * get_scalar_term();
65 }
66 
67 /**
68  * Write a string representation of this instance to <out>.
69  */
71 output(std::ostream &out) const {
72  #ifndef NDEBUG //[
73  out<<"LinearSinkForce";
74  #endif //] NDEBUG
75 }
76 
77 /**
78  * Write a string representation of this instance to <out>.
79  */
81 write(std::ostream &out, int indent) const {
82  #ifndef NDEBUG //[
83  out.width(indent); out<<""; out<<"LinearSinkForce:\n";
85  #endif //] NDEBUG
86 }
LinearSinkForce()
Simple constructor.
PN_stdfloat get_scalar_term() const
calculate the term based on falloff
A body on which physics will be applied.
Definition: physicsObject.h:27
virtual ~LinearSinkForce()
Simple destructor.
Pure virtual class for sinks and sources.
LPoint3 get_force_center() const
force_center query
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
Attractor force.
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
LPoint3 get_position() const
Position Query.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.