Special box tests
[Geometry algorithms]


Detailed Description


Functions

TL_DLL bool TeDisjointOrTouches (const TeBox &bx1, const TeBox &bx2)
 Check if box1 is DISJOINT or TOUCHes box2.
TL_DLL bool TeWithinOrTouches (const TeCoord2D &c, const TeCoord2D &c1, const TeCoord2D &c2)
 Check if coordinate c is WITHIN or TOUCHes segments c1 and c2.


Function Documentation

TL_DLL bool TeDisjointOrTouches ( const TeBox bx1,
const TeBox bx2 
)

Definition at line 1158 of file TeGeometryAlgorithms.cpp.

References TeGeometryAlgorithmsPrecision::IsGreaterEqual(), TeBox::x1(), TeBox::x2(), TeBox::y1(), and TeBox::y2().

01159 {
01160         // B1 to the right of or on B2
01161         if(TeGeometryAlgorithmsPrecision::IsGreaterEqual(bx1.x1(), bx2.x2())) 
01162                 return true;
01163 
01164         // B1 to the left of or on B2
01165         if(TeGeometryAlgorithmsPrecision::IsGreaterEqual(bx2.x1(), bx1.x2())) 
01166                 return true;
01167 
01168         // B2 is above or on B1
01169         if(TeGeometryAlgorithmsPrecision::IsGreaterEqual(bx2.y1(), bx1.y2())) 
01170                 return true;
01171 
01172         // B2 is below or on B1 
01173         if(TeGeometryAlgorithmsPrecision::IsGreaterEqual(bx1.y1(), bx2.y2())) 
01174                 return true;
01175 
01176         return false;
01177 }

TL_DLL bool TeWithinOrTouches ( const TeCoord2D c,
const TeCoord2D c1,
const TeCoord2D c2 
)

Definition at line 1248 of file TeGeometryAlgorithms.cpp.

References TeGeometryAlgorithmsPrecision::IsGreater(), TeGeometryAlgorithmsPrecision::IsSmaller(), TeCoord2D::x(), and TeCoord2D::y().

01249 {
01250         // c is to the right of c1 and c2
01251         if(TeGeometryAlgorithmsPrecision::IsGreater(c.x(), c1.x()) && TeGeometryAlgorithmsPrecision::IsGreater(c.x(), c2.x()))
01252                 return false;
01253 
01254         // c is above c1 and c2
01255         if(TeGeometryAlgorithmsPrecision::IsGreater(c.y(), c1.y()) && TeGeometryAlgorithmsPrecision::IsGreater(c.y(), c2.y()))
01256                 return false;
01257 
01258         // c is to the left of c1 and c2
01259         if(TeGeometryAlgorithmsPrecision::IsSmaller(c.x(), c1.x()) && TeGeometryAlgorithmsPrecision::IsSmaller(c.x(), c2.x()))
01260                 return false;
01261 
01262         // c is below c1 and c2
01263         if(TeGeometryAlgorithmsPrecision::IsSmaller(c.y(), c1.y()) && TeGeometryAlgorithmsPrecision::IsSmaller(c.y(), c2.y()))
01264                 return false;
01265 
01266         return true;    
01267 }


Generated on Sun Jul 29 04:04:39 2012 for TerraLib - Development Source by  doxygen 1.5.3