Panda3D
panda
src
physics
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::
42
get_falloff_type
()
const
{
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::
58
get_force_center
()
const
{
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
}
LinearDistanceForce::set_force_center
void set_force_center(const LPoint3 &p)
set the force center
Definition:
linearDistanceForce.I:34
LinearDistanceForce::get_force_center
LPoint3 get_force_center() const
force_center query
Definition:
linearDistanceForce.I:58
LinearDistanceForce::get_scalar_term
PN_stdfloat get_scalar_term() const
calculate the term based on falloff
Definition:
linearDistanceForce.I:66
LinearDistanceForce::set_falloff_type
void set_falloff_type(FalloffType ft)
falloff_type encapsulating wrap
Definition:
linearDistanceForce.I:18
LinearDistanceForce::get_radius
PN_stdfloat get_radius() const
radius query
Definition:
linearDistanceForce.I:50
LinearDistanceForce::set_radius
void set_radius(PN_stdfloat r)
set the radius
Definition:
linearDistanceForce.I:26
LinearDistanceForce::get_falloff_type
FalloffType get_falloff_type() const
falloff_type query
Definition:
linearDistanceForce.I:42
Generated on Mon Sep 14 2020 15:07:03 for Panda3D by
1.8.20