Files Classes Functions Hierarchy
#include <mathlib.h>
Static Public Member Functions | |
| template<class T > | |
| static boolc | unordered (T const a0, T const a1, T const b0, T const b1) |
| Do the two intervals overlap? | |
| template<class T > | |
| static boolc | unordered (T &c0, T &c1, T const a0, T const a1, T const b0, T const b1) |
| Find the common interval of intersection if it exists. | |
| template<class I > | |
| static boolc | unordered (I const *i0, I const *i1) |
| Do the two intervals overlap? | |
| template<class I > | |
| static boolc | unorderedD2 (I const *box0, I const *box1) |
| Test for overlap in two dimensions. | |
Definition at line 105 of file mathlib.h.
| static boolc intervalintersection::unordered | ( | I const * | i0, | |
| I const * | i1 | |||
| ) | [inline, static] |
Do the two intervals overlap?
Definition at line 133 of file mathlib.h.
References unordered().
Referenced by unordered().
00134 { return unordered(i0[0],i0[1],i1[0],i1[1]); }
| boolc intervalintersection::unordered | ( | T & | c0, | |
| T & | c1, | |||
| T const | a0, | |||
| T const | a1, | |||
| T const | b0, | |||
| T const | b1 | |||
| ) | [inline, static] |
Find the common interval of intersection if it exists.
Definition at line 942 of file mathlib.h.
00950 { 00951 // Order the points. 00952 T a[2]; 00953 if (a0<a1) 00954 { 00955 a[0] = a0; 00956 a[1] = a1; 00957 } 00958 else 00959 { 00960 a[1] = a0; 00961 a[0] = a1; 00962 } 00963 T b[2]; 00964 if (b0<b1) 00965 { 00966 b[0] = b0; 00967 b[1] = b1; 00968 } 00969 else 00970 { 00971 b[1] = b0; 00972 b[0] = b1; 00973 } 00974 00975 //cout << SHOW(a[0]) << " " << SHOW(a[1]) << endl; 00976 //cout << SHOW(b[0]) << " " << SHOW(b[1]) << endl; 00977 00978 if (a[1]<b[0]) 00979 return false; 00980 00981 if (b[1]<a[0]) 00982 return false; 00983 00984 // Find the intersection interval. 00985 if (a[0]<b[0]) 00986 { 00987 //cout << "a[0]<b[0]" << endl; 00988 if (b[1]<a[1]) 00989 { 00990 //cout << "b[1]<a[1]" << endl; 00991 c0 = b[0]; 00992 c1 = b[1]; 00993 } 00994 else 00995 { 00996 c0 = b[0]; 00997 c1 = a[1]; 00998 } 00999 } 01000 else 01001 { 01002 //cout << "b[0]<a[0]" << endl; 01003 if (a[1]<b[1]) 01004 { 01005 c0 = a[0]; 01006 c1 = a[1]; 01007 } 01008 else 01009 { 01010 c0 = a[0]; 01011 c1 = b[1]; 01012 } 01013 } 01014 01015 return true; 01016 }
| boolc intervalintersection::unordered | ( | T const | a0, | |
| T const | a1, | |||
| T const | b0, | |||
| T const | b1 | |||
| ) | [inline, static] |
Do the two intervals overlap?
Definition at line 897 of file mathlib.h.
Referenced by disk::intersects(), mathlibtest::test04(), mathlibtest::test05(), mathlibtest::test06(), and unorderedD2().
00903 { 00904 // Order the points. 00905 T a[2]; 00906 if (a0<a1) 00907 { 00908 a[0] = a0; 00909 a[1] = a1; 00910 } 00911 else 00912 { 00913 a[1] = a0; 00914 a[0] = a1; 00915 } 00916 T b[2]; 00917 if (b0<b1) 00918 { 00919 b[0] = b0; 00920 b[1] = b1; 00921 } 00922 else 00923 { 00924 b[1] = b0; 00925 b[0] = b1; 00926 } 00927 00928 if (a[1]<b[0]) 00929 return false; 00930 00931 if (b[1]<a[0]) 00932 return false; 00933 00934 return true; 00935 }
| static boolc intervalintersection::unorderedD2 | ( | I const * | box0, | |
| I const * | box1 | |||
| ) | [inline, static] |
Test for overlap in two dimensions.
The first row of I is the x interval, the second row is the y interval.
Definition at line 141 of file mathlib.h.
References unordered().
Referenced by mathlibtest::test07().
00142 { 00143 if (unordered(box0,box1)==false) 00144 return false; 00145 00146 return unordered(box0+2,box1+2); 00147 }
1.5.8