Panda3D
 All Classes Functions Variables Enumerations
boundingLine.I
1 // Filename: boundingLine.I
2 // Created by: drose (04Jul00)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: BoundingLine::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE_MATHUTIL BoundingLine::
22 BoundingLine() {
23 }
24 
25 ////////////////////////////////////////////////////////////////////
26 // Function: BoundingLine::Constructor
27 // Access: Published
28 // Description:
29 ////////////////////////////////////////////////////////////////////
30 INLINE_MATHUTIL BoundingLine::
31 BoundingLine(const LPoint3 &a, const LPoint3 &b) :
32  _origin(a), _vector(b - a)
33 {
34  _vector.normalize();
35  _flags = 0;
36  nassertd(!_origin.is_nan() && !_vector.is_nan()) {
37  _flags = F_empty;
38  }
39 }
40 
41 ////////////////////////////////////////////////////////////////////
42 // Function: BoundingLine::get_point_a
43 // Access: Published
44 // Description: Returns the first point that defines the line.
45 ////////////////////////////////////////////////////////////////////
46 INLINE_MATHUTIL const LPoint3 &BoundingLine::
47 get_point_a() const {
48  nassertr(!is_empty(), _origin);
49  nassertr(!is_infinite(), _origin);
50  return _origin;
51 }
52 
53 ////////////////////////////////////////////////////////////////////
54 // Function: BoundingLine::get_point_b
55 // Access: Published
56 // Description: Returns the second point that defines the line.
57 ////////////////////////////////////////////////////////////////////
58 INLINE_MATHUTIL LPoint3 BoundingLine::
59 get_point_b() const {
60  nassertr(!is_empty(), _origin);
61  nassertr(!is_infinite(), _origin);
62  return _origin + _vector;
63 }
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
bool is_nan() const
Returns true if any component of the vector is not-a-number, false otherwise.
Definition: lvecBase3.h:463
const LPoint3 & get_point_a() const
Returns the first point that defines the line.
Definition: boundingLine.I:47
bool is_infinite() const
The other side of the empty coin is an infinite volume.
LPoint3 get_point_b() const
Returns the second point that defines the line.
Definition: boundingLine.I:59
bool is_empty() const
Any kind of volume might be empty.
bool normalize()
Normalizes the vector in place.
Definition: lvecBase3.h:782