Panda3D
linearDistanceForce.I
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 linearDistanceForce.I
10  * @author charles
11  * @date 2000-06-21
12  */
13 
14 /**
15  * falloff_type encapsulating wrap
16  */
17 INLINE void LinearDistanceForce::
18 set_falloff_type(FalloffType ft) {
19  _falloff = ft;
20 }
21 
22 /**
23  * set the radius
24  */
25 INLINE void LinearDistanceForce::
26 set_radius(PN_stdfloat r) {
27  _radius = r;
28 }
29 
30 /**
31  * set the force center
32  */
33 INLINE void LinearDistanceForce::
34 set_force_center(const LPoint3& p) {
35  _force_center = p;
36 }
37 
38 /**
39  * falloff_type query
40  */
41 INLINE LinearDistanceForce::FalloffType LinearDistanceForce::
43  return _falloff;
44 }
45 
46 /**
47  * radius query
48  */
49 INLINE PN_stdfloat LinearDistanceForce::
50 get_radius() const {
51  return _radius;
52 }
53 
54 /**
55  * force_center query
56  */
57 INLINE LPoint3 LinearDistanceForce::
59  return _force_center;
60 }
61 
62 /**
63  * calculate the term based on falloff
64  */
65 INLINE PN_stdfloat LinearDistanceForce::
66 get_scalar_term() const {
67  PN_stdfloat r = _radius;
68  if (_falloff == FT_ONE_OVER_R_SQUARED)
69  r = r * r;
70  else if (_falloff == FT_ONE_OVER_R_CUBED)
71  r = r * r * r;
72 
73  return (1.0f / r);
74 }
PN_stdfloat get_scalar_term() const
calculate the term based on falloff
void set_falloff_type(FalloffType ft)
falloff_type encapsulating wrap
LPoint3 get_force_center() const
force_center query
PN_stdfloat get_radius() const
radius query
void set_radius(PN_stdfloat r)
set the radius
void set_force_center(const LPoint3 &p)
set the force center
FalloffType get_falloff_type() const
falloff_type query