00001 // Filename: collisionPolygon.I 00002 // Created by: drose (25Apr00) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) 2001, Disney Enterprises, Inc. All rights reserved 00008 // 00009 // All use of this software is subject to the terms of the Panda 3d 00010 // Software license. You should have received a copy of this license 00011 // along with this source code; you will also find a current copy of 00012 // the license at http://www.panda3d.org/license.txt . 00013 // 00014 // To contact the maintainers of this program write to 00015 // panda3d@yahoogroups.com . 00016 // 00017 //////////////////////////////////////////////////////////////////// 00018 00019 //////////////////////////////////////////////////////////////////// 00020 // Function: CollisionPolygon::Constructor 00021 // Access: Public 00022 // Description: 00023 //////////////////////////////////////////////////////////////////// 00024 INLINE CollisionPolygon:: 00025 CollisionPolygon(const LPoint3f &a, const LPoint3f &b, 00026 const LPoint3f &c) { 00027 LPoint3f array[3]; 00028 array[0] = a; 00029 array[1] = b; 00030 array[2] = c; 00031 setup_points(array, array + 3); 00032 } 00033 00034 //////////////////////////////////////////////////////////////////// 00035 // Function: CollisionPolygon::Constructor 00036 // Access: Public 00037 // Description: 00038 //////////////////////////////////////////////////////////////////// 00039 INLINE CollisionPolygon:: 00040 CollisionPolygon(const LPoint3f &a, const LPoint3f &b, 00041 const LPoint3f &c, const LPoint3f &d) { 00042 LPoint3f array[4]; 00043 array[0] = a; 00044 array[1] = b; 00045 array[2] = c; 00046 array[3] = d; 00047 setup_points(array, array + 4); 00048 } 00049 00050 00051 //////////////////////////////////////////////////////////////////// 00052 // Function: CollisionPolygon::Constructor 00053 // Access: Public 00054 // Description: 00055 //////////////////////////////////////////////////////////////////// 00056 INLINE CollisionPolygon:: 00057 CollisionPolygon(const LPoint3f *begin, const LPoint3f *end) { 00058 setup_points(begin, end); 00059 } 00060 00061 //////////////////////////////////////////////////////////////////// 00062 // Function: CollisionPolygon::Constructor 00063 // Access: Public 00064 // Description: 00065 //////////////////////////////////////////////////////////////////// 00066 INLINE CollisionPolygon:: 00067 CollisionPolygon(void) { 00068 } 00069 00070 //////////////////////////////////////////////////////////////////// 00071 // Function: CollisionPolygon::verify_points 00072 // Access: Public, Static 00073 // Description: Verifies that the indicated set of points will define 00074 // a valid CollisionPolygon: that is, at least three 00075 // non-collinear points, with no points repeated. 00076 //////////////////////////////////////////////////////////////////// 00077 INLINE bool CollisionPolygon:: 00078 verify_points(const LPoint3f &a, const LPoint3f &b, 00079 const LPoint3f &c) { 00080 LPoint3f array[3]; 00081 array[0] = a; 00082 array[1] = b; 00083 array[2] = c; 00084 return verify_points(array, array + 3); 00085 } 00086 00087 //////////////////////////////////////////////////////////////////// 00088 // Function: CollisionPolygon::verify_points 00089 // Access: Public, Static 00090 // Description: Verifies that the indicated set of points will define 00091 // a valid CollisionPolygon: that is, at least three 00092 // non-collinear points, with no points repeated. 00093 //////////////////////////////////////////////////////////////////// 00094 INLINE bool CollisionPolygon:: 00095 verify_points(const LPoint3f &a, const LPoint3f &b, 00096 const LPoint3f &c, const LPoint3f &d) { 00097 LPoint3f array[4]; 00098 array[0] = a; 00099 array[1] = b; 00100 array[2] = c; 00101 array[3] = d; 00102 return verify_points(array, array + 4); 00103 }