Milena (Olena)
User documentation 2.0a Id
Main Page
Related Pages
Modules
Namespaces
Classes
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerator
Groups
Pages
win_chamfer.hh
1
// Copyright (C) 2006, 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
2
//
3
// This file is part of Olena.
4
//
5
// Olena is free software: you can redistribute it and/or modify it under
6
// the terms of the GNU General Public License as published by the Free
7
// Software Foundation, version 2 of the License.
8
//
9
// Olena is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
// General Public License for more details.
13
//
14
// You should have received a copy of the GNU General Public License
15
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
16
//
17
// As a special exception, you may use this file as part of a free
18
// software project without restriction. Specifically, if other files
19
// instantiate templates or use macros or inline functions from this
20
// file, or you compile this file and link it with other files to produce
21
// an executable, this file does not by itself cause the resulting
22
// executable to be covered by the GNU General Public License. This
23
// exception does not however invalidate any other reasons why the
24
// executable file might be covered by the GNU General Public License.
25
26
#ifndef MLN_MAKE_WIN_CHAMFER_HH
27
# define MLN_MAKE_WIN_CHAMFER_HH
28
34
35
# include <cmath>
36
37
# include <mln/core/alias/w_window2d_int.hh>
38
# include <mln/core/alias/w_window2d_float.hh>
39
40
41
namespace
mln
42
{
43
44
namespace
make
45
{
46
47
template
<
int
d10,
int
d11>
48
mln::w_window2d_int
49
mk_chamfer_3x3_int();
50
51
template
<
int
d10,
int
d11,
int
d21>
52
mln::w_window2d_int
53
mk_chamfer_5x5_int();
54
55
mln::w_window2d_float
56
mk_chamfer_3x3_float(
float
d10,
float
d11);
57
58
mln::w_window2d_float
59
mk_chamfer_5x5_float(
float
d10,
float
d11,
float
d21);
60
61
mln::w_window2d_float
62
mk_chamfer_exact();
63
64
65
# ifndef MLN_INCLUDE_ONLY
66
67
template
<
int
d10,
int
d11>
68
inline
69
mln::w_window2d_int
70
mk_chamfer_3x3_int()
71
{
72
int
ws[] = { d11, d10, d11,
73
d10, 0, 0,
74
0, 0, 0 };
75
76
return
make::w_window2d
(ws);
77
}
78
79
template
<
int
d10,
int
d11,
int
d21>
80
inline
81
mln::w_window2d_int
82
mk_chamfer_5x5_int()
83
{
84
int
ws[] = { 0, d21, 0, d21, 0,
85
d21, d11, d10, d11, d21,
86
0, d10, 0, 0, 0,
87
0, 0, 0, 0, 0,
88
0, 0, 0, 0, 0 };
89
90
return
make::w_window2d
(ws);
91
}
92
93
inline
94
mln::w_window2d_float
95
mk_chamfer_3x3_float(
float
d10,
float
d11)
96
{
97
float
ws[] = { d11, d10, d11,
98
d10, 0, 0,
99
0, 0, 0 };
100
101
return
make::w_window2d
(ws);
102
}
103
104
inline
105
mln::w_window2d_float
106
mk_chamfer_5x5_float(
float
d10,
float
d11,
float
d21)
107
{
108
float
ws[] = { 0, d21, 0, d21, 0,
109
d21, d11, d10, d11, d21,
110
0, d10, 0, 0, 0,
111
0, 0, 0, 0, 0,
112
0, 0, 0, 0, 0 };
113
114
return
make::w_window2d
(ws);
115
}
116
117
inline
118
mln::w_window2d_float
119
mk_chamfer_exact()
120
{
121
float
r2 = std::sqrt(2.0f);
122
float
ws[] = { r2, 1, r2,
123
1, 0, 0,
124
0, 0, 0 };
125
126
return
make::w_window2d
(ws);
127
}
128
129
# endif // ! MLN_INCLUDE_ONLY
130
131
}
// end of namespace mln::make
132
133
}
// end of namespace mln
134
135
136
#endif // ! MLN_MAKE_WIN_CHAMFER_HH
mln
make
win_chamfer.hh
Generated on Thu Nov 8 2012 10:58:26 for Milena (Olena) by
1.8.2-20120930