-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMPI_BoundingBox.h
47 lines (31 loc) · 1020 Bytes
/
MPI_BoundingBox.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// MPI_BoundingBox.h
//
// Description:
// 2D bounding box class for tracking the spatial extents of an object.
// Used for avoiding unnecessary expensive computations.
//
#ifndef __MPI_BOUNDINGBOX_H__
#define __MPI_BOUNDINGBOX_H__
#include "MPI_Point2D.h"
class MPI_BoundingBox
{
public:
MPI_BoundingBox(MPI_Point2D const& firstpoint, MPI_Point2D const& secondpoint);
// intersection queries
bool overlaps( MPI_BoundingBox const& otherbox ) const;
bool contains( MPI_Point2D const& point ) const;
// extend bounding box to contain the given point
void extendToContain( MPI_Point2D const& point );
// get corners
MPI_Point2D const& getLowerLeft( void ) const;
MPI_Point2D const& getUpperRight( void ) const;
void print( std::ostream &os ) const;
private:
// the two opposite corners
MPI_Point2D lowerleft_;
MPI_Point2D upperright_;
};
std::ostream &operator<<( std::ostream &os, MPI_BoundingBox const &bbox );
#endif
// vim:sw=4:et:cindent: