Panda3D
panda
src
mathutil
boundingSphere.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 boundingSphere.I
10
* @author drose
11
* @date 1999-10-02
12
*/
13
14
/**
15
* Constructs an empty sphere.
16
*/
17
INLINE_MATHUTIL
BoundingSphere::
18
BoundingSphere
() : _center(0) {
19
}
20
21
/**
22
* Constructs a specific sphere.
23
*/
24
INLINE_MATHUTIL
BoundingSphere::
25
BoundingSphere
(
const
LPoint3 ¢er, PN_stdfloat radius) :
26
_center(center), _radius(radius)
27
{
28
_flags = 0;
29
nassertd(!_center.is_nan() && !cnan(_radius)) {
30
_flags = F_empty;
31
}
32
}
33
34
/**
35
*
36
*/
37
INLINE_MATHUTIL LPoint3 BoundingSphere::
38
get_center()
const
{
39
nassertr(!
is_infinite
(), LPoint3::zero());
40
return
_center;
41
}
42
43
/**
44
*
45
*/
46
INLINE_MATHUTIL PN_stdfloat BoundingSphere::
47
get_radius()
const
{
48
nassertr(!
is_empty
(), 0.0f);
49
nassertr(!
is_infinite
(), 0.0f);
50
return
_radius;
51
}
52
53
/**
54
* Sets the center point of the sphere.
55
*/
56
INLINE_MATHUTIL
void
BoundingSphere::
57
set_center
(
const
LPoint3 ¢er) {
58
nassertv(!center.is_nan());
59
_center = center;
60
}
61
62
/**
63
* Sets the radius of the sphere.
64
*/
65
INLINE_MATHUTIL
void
BoundingSphere::
66
set_radius
(PN_stdfloat radius) {
67
nassertv(!cnan(radius));
68
_radius = radius;
69
_flags = 0;
70
}
BoundingSphere::BoundingSphere
BoundingSphere()
Constructs an empty sphere.
Definition:
boundingSphere.I:18
BoundingSphere::set_radius
set_radius
Sets the radius of the sphere.
Definition:
boundingSphere.h:51
BoundingVolume::is_infinite
bool is_infinite() const
The other side of the empty coin is an infinite volume.
Definition:
boundingVolume.I:44
BoundingSphere::set_center
set_center
Sets the center point of the sphere.
Definition:
boundingSphere.h:50
BoundingVolume::is_empty
bool is_empty() const
Any kind of volume might be empty.
Definition:
boundingVolume.I:29
Generated on Sat Jan 11 2020 15:15:14 for Panda3D by
1.8.17