Claw
1.7.3
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
rectangle.hpp
Go to the documentation of this file.
1
/*
2
CLAW - a C++ Library Absolutely Wonderful
3
4
CLAW is a free library without any particular aim but being useful to
5
anyone.
6
7
Copyright (C) 2005-2011 Julien Jorge
8
9
This library is free software; you can redistribute it and/or
10
modify it under the terms of the GNU Lesser General Public
11
License as published by the Free Software Foundation; either
12
version 2.1 of the License, or (at your option) any later version.
13
14
This library is distributed in the hope that it will be useful,
15
but WITHOUT ANY WARRANTY; without even the implied warranty of
16
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17
Lesser General Public License for more details.
18
19
You should have received a copy of the GNU Lesser General Public
20
License along with this library; if not, write to the Free Software
21
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22
23
contact: julien.jorge@gamned.org
24
*/
31
#ifndef __CLAW_RECTANGLE_HPP__
32
#define __CLAW_RECTANGLE_HPP__
33
34
#include <
claw/coordinate_2d.hpp
>
35
#include <
claw/box_2d.hpp
>
36
37
namespace
claw
38
{
39
namespace
math
40
{
50
template
<
class
T>
51
class
rectangle
52
{
53
public
:
55
typedef
T
value_type
;
56
58
typedef
rectangle<value_type>
self_type
;
59
60
public
:
61
rectangle
();
62
63
template
<
typename
U>
64
rectangle
(
const
rectangle<U>
& that );
65
66
template
<
typename
U>
67
rectangle
(
const
box_2d<U>
& that );
68
69
rectangle
(
const
value_type
& _x,
const
value_type
& _y,
70
const
value_type
& _width,
const
value_type
& _height);
71
72
template
<
typename
U>
73
rectangle
(
const
coordinate_2d<U>
& pos,
const
value_type
& _width,
74
const
value_type
& _height );
75
76
template
<
typename
U>
77
rectangle
(
const
coordinate_2d<U>
& pos,
const
coordinate_2d<U>
&
size
);
78
79
template
<
typename
U>
80
rectangle<U>
cast_value_type_to
()
const
;
81
82
bool
operator==
(
const
self_type
& that )
const
;
83
bool
operator!=
(
const
self_type
& that )
const
;
84
85
value_type
area
()
const
;
86
bool
includes
(
const
coordinate_2d<value_type>
& p )
const
;
87
bool
includes
(
const
self_type
& r )
const
;
88
bool
intersects
(
const
self_type
& r )
const
;
89
self_type
intersection
(
const
self_type
& r )
const
;
90
self_type
join
(
const
self_type
& r )
const
;
91
92
void
set
(
const
value_type
& new_x,
const
value_type
& new_y,
93
const
value_type
& new_width,
const
value_type
& new_height );
94
95
value_type
left
()
const
;
96
value_type
right
()
const
;
97
value_type
bottom
()
const
;
98
value_type
top
()
const
;
99
100
coordinate_2d<value_type>
size
()
const
;
101
102
private
:
103
void
x_intersection(
const
self_type
& r,
self_type
& result )
const
;
104
void
y_intersection(
const
self_type
& r,
self_type
& result )
const
;
105
106
public
:
108
coordinate_2d<value_type>
position
;
109
111
value_type
width
;
112
114
value_type
height
;
115
116
};
// class rectangle
117
}
// namespace math
118
}
// namespace claw
119
120
#include <
claw/impl/rectangle.tpp
>
121
122
#endif // __CLAW_RECTANGLE_HPP__
Generated on Thu Mar 14 2013 22:09:24 for Claw by
1.8.1.2