Panda3D
Loading...
Searching...
No Matches
linearSourceForce.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 linearSourceForce.cxx
10 * @author charles
11 * @date 2000-06-21
12 */
13
14#include "linearSourceForce.h"
15
16TypeHandle LinearSourceForce::_type_handle;
17
18/**
19 * Simple constructor
20 */
22LinearSourceForce(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 */
43
44/**
45 * Simple destructor
46 */
50
51/**
52 * copier
53 */
54LinearForce *LinearSourceForce::
55make_copy() {
56 return new LinearSourceForce(*this);
57}
58
59/**
60 * virtual force query
61 */
62LVector3 LinearSourceForce::
63get_child_vector(const PhysicsObject *po) {
64 return (po->get_position() - get_force_center()) * get_scalar_term();
65}
66
67/**
68 * Write a string representation of this instance to <out>.
69 */
71output(std::ostream &out) const {
72 #ifndef NDEBUG //[
73 out<<"LinearSourceForce";
74 #endif //] NDEBUG
75}
76
77/**
78 * Write a string representation of this instance to <out>.
79 */
81write(std::ostream &out, int indent) const {
82 #ifndef NDEBUG //[
83 out.width(indent); out<<""; out<<"LinearSourceForce:\n";
85 #endif //] NDEBUG
86}
Pure virtual class for sinks and sources.
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
PN_stdfloat get_scalar_term() const
calculate the term based on falloff
LPoint3 get_force_center() const
force_center query
A force that acts on a PhysicsObject by way of an Integrator.
Definition linearForce.h:23
Repellant force.
LinearSourceForce()
Simple constructor.
virtual ~LinearSourceForce()
Simple destructor.
virtual void write(std::ostream &out, int indent=0) const
Write a string representation of this instance to <out>.
virtual void output(std::ostream &out) const
Write a string representation of this instance to <out>.
A body on which physics will be applied.
get_position
Position Query.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition indent.cxx:20
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.