Milena (Olena)
User documentation 2.0a Id
|
00001 // Copyright (C) 2006, 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) 00002 // 00003 // This file is part of Olena. 00004 // 00005 // Olena is free software: you can redistribute it and/or modify it under 00006 // the terms of the GNU General Public License as published by the Free 00007 // Software Foundation, version 2 of the License. 00008 // 00009 // Olena is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 // General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Olena. If not, see <http://www.gnu.org/licenses/>. 00016 // 00017 // As a special exception, you may use this file as part of a free 00018 // software project without restriction. Specifically, if other files 00019 // instantiate templates or use macros or inline functions from this 00020 // file, or you compile this file and link it with other files to produce 00021 // an executable, this file does not by itself cause the resulting 00022 // executable to be covered by the GNU General Public License. This 00023 // exception does not however invalidate any other reasons why the 00024 // executable file might be covered by the GNU General Public License. 00025 00026 #ifndef MLN_MAKE_WIN_CHAMFER_HH 00027 # define MLN_MAKE_WIN_CHAMFER_HH 00028 00034 00035 # include <cmath> 00036 00037 # include <mln/core/alias/w_window2d_int.hh> 00038 # include <mln/core/alias/w_window2d_float.hh> 00039 00040 00041 namespace mln 00042 { 00043 00044 namespace make 00045 { 00046 00047 template<int d10, int d11> 00048 mln::w_window2d_int 00049 mk_chamfer_3x3_int(); 00050 00051 template<int d10, int d11, int d21> 00052 mln::w_window2d_int 00053 mk_chamfer_5x5_int(); 00054 00055 mln::w_window2d_float 00056 mk_chamfer_3x3_float(float d10, float d11); 00057 00058 mln::w_window2d_float 00059 mk_chamfer_5x5_float(float d10, float d11, float d21); 00060 00061 mln::w_window2d_float 00062 mk_chamfer_exact(); 00063 00064 00065 # ifndef MLN_INCLUDE_ONLY 00066 00067 template<int d10, int d11> 00068 inline 00069 mln::w_window2d_int 00070 mk_chamfer_3x3_int() 00071 { 00072 int ws[] = { d11, d10, d11, 00073 d10, 0, 0, 00074 0, 0, 0 }; 00075 00076 return make::w_window2d(ws); 00077 } 00078 00079 template<int d10, int d11, int d21> 00080 inline 00081 mln::w_window2d_int 00082 mk_chamfer_5x5_int() 00083 { 00084 int ws[] = { 0, d21, 0, d21, 0, 00085 d21, d11, d10, d11, d21, 00086 0, d10, 0, 0, 0, 00087 0, 0, 0, 0, 0, 00088 0, 0, 0, 0, 0 }; 00089 00090 return make::w_window2d(ws); 00091 } 00092 00093 inline 00094 mln::w_window2d_float 00095 mk_chamfer_3x3_float(float d10, float d11) 00096 { 00097 float ws[] = { d11, d10, d11, 00098 d10, 0, 0, 00099 0, 0, 0 }; 00100 00101 return make::w_window2d(ws); 00102 } 00103 00104 inline 00105 mln::w_window2d_float 00106 mk_chamfer_5x5_float(float d10, float d11, float d21) 00107 { 00108 float ws[] = { 0, d21, 0, d21, 0, 00109 d21, d11, d10, d11, d21, 00110 0, d10, 0, 0, 0, 00111 0, 0, 0, 0, 0, 00112 0, 0, 0, 0, 0 }; 00113 00114 return make::w_window2d(ws); 00115 } 00116 00117 inline 00118 mln::w_window2d_float 00119 mk_chamfer_exact() 00120 { 00121 float r2 = std::sqrt(2.0f); 00122 float ws[] = { r2, 1, r2, 00123 1, 0, 0, 00124 0, 0, 0 }; 00125 00126 return make::w_window2d(ws); 00127 } 00128 00129 # endif // ! MLN_INCLUDE_ONLY 00130 00131 } // end of namespace mln::make 00132 00133 } // end of namespace mln 00134 00135 00136 #endif // ! MLN_MAKE_WIN_CHAMFER_HH