-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBBox2.hxx
More file actions
47 lines (36 loc) · 1009 Bytes
/
BBox2.hxx
File metadata and controls
47 lines (36 loc) · 1009 Bytes
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
////////////////////////////////////////////////////////////////////
//
// $Id: BBox2.hxx 2021/06/05 13:23:57 kanai Exp $
//
// Copyright (c) 2021 Takashi Kanai
// Released under the MIT license
//
////////////////////////////////////////////////////////////////////
#ifndef _BBOX2_HXX
#define _BBOX2_HXX 1
#include <cmath>
#include <Point2.h>
#ifdef VM_INCLUDE_NAMESPACE
using namespace kh_vecmath;
#endif // VM_INCLUDE_NAMESPACE
typedef Point2<int> Point2i;
class BBox2 {
Point2i start;
Point2i end;
public:
BBox2() {};
~BBox2() {};
void clear() { start.set(0,0); end.set(0,0); };
void setStart( int x, int y ) { start.set( x, y ); };
void setEnd( int x, int y ) { end.set( x, y ); };
int& sx() { return start.x; };
int& sy() { return start.y; };
int& ex() { return end.x; };
int& ey() { return end.y; };
bool isRectangle() {
if ( (std::abs(start.x - end.x) > 4) && (std::abs(start.y - end.y) > 4) )
return true;
return false;
};
};
#endif // _BBOX2_HXX