00001 // Filename: boundingLine.I 00002 // Created by: drose (04Jul00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: BoundingLine::Constructor 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE_MATHUTIL BoundingLine:: 00022 BoundingLine() { 00023 } 00024 00025 //////////////////////////////////////////////////////////////////// 00026 // Function: BoundingLine::Constructor 00027 // Access: Published 00028 // Description: 00029 //////////////////////////////////////////////////////////////////// 00030 INLINE_MATHUTIL BoundingLine:: 00031 BoundingLine(const LPoint3 &a, const LPoint3 &b) : 00032 _origin(a), _vector(b - a) 00033 { 00034 _vector.normalize(); 00035 _flags = 0; 00036 nassertd(!_origin.is_nan() && !_vector.is_nan()) { 00037 _flags = F_empty; 00038 } 00039 } 00040 00041 //////////////////////////////////////////////////////////////////// 00042 // Function: BoundingLine::get_point_a 00043 // Access: Published 00044 // Description: Returns the first point that defines the line. 00045 //////////////////////////////////////////////////////////////////// 00046 INLINE_MATHUTIL const LPoint3 &BoundingLine:: 00047 get_point_a() const { 00048 nassertr(!is_empty(), _origin); 00049 nassertr(!is_infinite(), _origin); 00050 return _origin; 00051 } 00052 00053 //////////////////////////////////////////////////////////////////// 00054 // Function: BoundingLine::get_point_b 00055 // Access: Published 00056 // Description: Returns the second point that defines the line. 00057 //////////////////////////////////////////////////////////////////// 00058 INLINE_MATHUTIL LPoint3 BoundingLine:: 00059 get_point_b() const { 00060 nassertr(!is_empty(), _origin); 00061 nassertr(!is_infinite(), _origin); 00062 return _origin + _vector; 00063 }