shape_doc 0.1
|
00001 00002 #include <numerix/integer.hpp> 00003 #include <numerix/rational.hpp> 00004 #include <numerix/floating.hpp> 00005 #include <basix/vector.hpp> 00006 #include <shape/axel_glue.hpp> 00007 #include <shape/point_glue.hpp> 00008 #include <basix/tuple.hpp> 00009 #include <basix/alias.hpp> 00010 #include <basix/glue.hpp> 00011 00012 #define shape_point shape::point 00013 00014 namespace mmx { 00015 static bool 00016 GLUE_1 (const generic &arg_1) { 00017 return is_vector (arg_1); 00018 } 00019 00020 static vector<mmx_floating> 00021 GLUE_2 (const tuple<mmx_floating> &arg_1) { 00022 return vector<mmx_floating > (as_vector (arg_1)); 00023 } 00024 00025 static vector<mmx_floating> 00026 GLUE_3 (const tuple<mmx_floating> &arg_1) { 00027 return vector<mmx_floating > (as_vector (arg_1)); 00028 } 00029 00030 static iterator<generic> 00031 GLUE_4 (const vector<mmx_floating> &arg_1) { 00032 return as<iterator<generic> > (iterate (arg_1)); 00033 } 00034 00035 static int 00036 GLUE_5 (const vector<mmx_floating> &arg_1) { 00037 return N (arg_1); 00038 } 00039 00040 static mmx_floating 00041 GLUE_6 (const vector<mmx_floating> &arg_1, const int &arg_2) { 00042 return arg_1[arg_2]; 00043 } 00044 00045 static alias<mmx_floating> 00046 GLUE_7 (const alias<vector<mmx_floating> > &arg_1, const int &arg_2) { 00047 return alias_access<mmx_floating > (arg_1, arg_2); 00048 } 00049 00050 static vector<mmx_floating> 00051 GLUE_8 (const vector<mmx_floating> &arg_1, const int &arg_2, const int &arg_3) { 00052 return range (arg_1, arg_2, arg_3); 00053 } 00054 00055 static vector<mmx_floating> 00056 GLUE_9 (const vector<mmx_floating> &arg_1) { 00057 return reverse (arg_1); 00058 } 00059 00060 static vector<mmx_floating> 00061 GLUE_10 (const vector<mmx_floating> &arg_1, const vector<mmx_floating> &arg_2) { 00062 return append (arg_1, arg_2); 00063 } 00064 00065 static alias<vector<mmx_floating> > 00066 GLUE_11 (const alias<vector<mmx_floating> > &arg_1, const vector<mmx_floating> &arg_2) { 00067 return alias_write (arg_1, arg_2); 00068 } 00069 00070 static vector<mmx_floating> 00071 GLUE_12 (const mmx_floating &arg_1, const vector<mmx_floating> &arg_2) { 00072 return cons (arg_1, arg_2); 00073 } 00074 00075 static mmx_floating 00076 GLUE_13 (const vector<mmx_floating> &arg_1) { 00077 return car (arg_1); 00078 } 00079 00080 static vector<mmx_floating> 00081 GLUE_14 (const vector<mmx_floating> &arg_1) { 00082 return cdr (arg_1); 00083 } 00084 00085 static bool 00086 GLUE_15 (const vector<mmx_floating> &arg_1) { 00087 return is_nil (arg_1); 00088 } 00089 00090 static bool 00091 GLUE_16 (const vector<mmx_floating> &arg_1) { 00092 return is_atom (arg_1); 00093 } 00094 00095 static vector<mmx_floating> 00096 GLUE_17 (const vector<mmx_floating> &arg_1, const mmx_floating &arg_2) { 00097 return insert (arg_1, arg_2); 00098 } 00099 00100 static int 00101 GLUE_18 (const vector<mmx_floating> &arg_1, const mmx_floating &arg_2) { 00102 return find (arg_1, arg_2); 00103 } 00104 00105 static bool 00106 GLUE_19 (const vector<mmx_floating> &arg_1, const mmx_floating &arg_2) { 00107 return contains (arg_1, arg_2); 00108 } 00109 00110 static vector<mmx_floating> 00111 GLUE_20 (const vector<mmx_floating> &arg_1) { 00112 return -arg_1; 00113 } 00114 00115 static vector<mmx_floating> 00116 GLUE_21 (const vector<mmx_floating> &arg_1) { 00117 return square (arg_1); 00118 } 00119 00120 static vector<mmx_floating> 00121 GLUE_22 (const vector<mmx_floating> &arg_1, const vector<mmx_floating> &arg_2) { 00122 return arg_1 + arg_2; 00123 } 00124 00125 static vector<mmx_floating> 00126 GLUE_23 (const vector<mmx_floating> &arg_1, const vector<mmx_floating> &arg_2) { 00127 return arg_1 - arg_2; 00128 } 00129 00130 static vector<mmx_floating> 00131 GLUE_24 (const vector<mmx_floating> &arg_1, const vector<mmx_floating> &arg_2) { 00132 return arg_1 * arg_2; 00133 } 00134 00135 static vector<mmx_floating> 00136 GLUE_25 (const mmx_floating &arg_1, const vector<mmx_floating> &arg_2) { 00137 return arg_1 + arg_2; 00138 } 00139 00140 static vector<mmx_floating> 00141 GLUE_26 (const vector<mmx_floating> &arg_1, const mmx_floating &arg_2) { 00142 return arg_1 + arg_2; 00143 } 00144 00145 static vector<mmx_floating> 00146 GLUE_27 (const mmx_floating &arg_1, const vector<mmx_floating> &arg_2) { 00147 return arg_1 - arg_2; 00148 } 00149 00150 static vector<mmx_floating> 00151 GLUE_28 (const vector<mmx_floating> &arg_1, const mmx_floating &arg_2) { 00152 return arg_1 - arg_2; 00153 } 00154 00155 static vector<mmx_floating> 00156 GLUE_29 (const mmx_floating &arg_1, const vector<mmx_floating> &arg_2) { 00157 return arg_1 * arg_2; 00158 } 00159 00160 static vector<mmx_floating> 00161 GLUE_30 (const vector<mmx_floating> &arg_1, const mmx_floating &arg_2) { 00162 return arg_1 * arg_2; 00163 } 00164 00165 static mmx_floating 00166 GLUE_31 (const vector<mmx_floating> &arg_1, const vector<mmx_floating> &arg_2) { 00167 return dot (arg_1, arg_2); 00168 } 00169 00170 static mmx_floating 00171 GLUE_32 (const vector<mmx_floating> &arg_1) { 00172 return big_mul (arg_1); 00173 } 00174 00175 static mmx_floating 00176 GLUE_33 (const vector<mmx_floating> &arg_1) { 00177 return big_add (arg_1); 00178 } 00179 00180 static vector<mmx_floating> 00181 GLUE_34 (const vector<mmx_floating> &arg_1, const vector<mmx_floating> &arg_2) { 00182 return arg_1 / arg_2; 00183 } 00184 00185 static vector<mmx_floating> 00186 GLUE_35 (const mmx_floating &arg_1, const vector<mmx_floating> &arg_2) { 00187 return arg_1 / arg_2; 00188 } 00189 00190 static vector<mmx_floating> 00191 GLUE_36 (const vector<mmx_floating> &arg_1, const mmx_floating &arg_2) { 00192 return arg_1 / arg_2; 00193 } 00194 00195 static bool 00196 GLUE_37 (const vector<mmx_floating> &arg_1, const vector<mmx_floating> &arg_2) { 00197 return arg_1 <= arg_2; 00198 } 00199 00200 static bool 00201 GLUE_38 (const vector<mmx_floating> &arg_1, const vector<mmx_floating> &arg_2) { 00202 return arg_1 >= arg_2; 00203 } 00204 00205 static bool 00206 GLUE_39 (const vector<mmx_floating> &arg_1, const vector<mmx_floating> &arg_2) { 00207 return arg_1 < arg_2; 00208 } 00209 00210 static bool 00211 GLUE_40 (const vector<mmx_floating> &arg_1, const vector<mmx_floating> &arg_2) { 00212 return arg_1 > arg_2; 00213 } 00214 00215 static vector<mmx_floating> 00216 GLUE_41 (const vector<mmx_floating> &arg_1) { 00217 return sqrt (arg_1); 00218 } 00219 00220 static vector<mmx_floating> 00221 GLUE_42 (const vector<mmx_floating> &arg_1) { 00222 return exp (arg_1); 00223 } 00224 00225 static vector<mmx_floating> 00226 GLUE_43 (const vector<mmx_floating> &arg_1) { 00227 return log (arg_1); 00228 } 00229 00230 static vector<mmx_floating> 00231 GLUE_44 (const vector<mmx_floating> &arg_1, const vector<mmx_floating> &arg_2) { 00232 return pow (arg_1, arg_2); 00233 } 00234 00235 static vector<mmx_floating> 00236 GLUE_45 (const vector<mmx_floating> &arg_1) { 00237 return cos (arg_1); 00238 } 00239 00240 static vector<mmx_floating> 00241 GLUE_46 (const vector<mmx_floating> &arg_1) { 00242 return sin (arg_1); 00243 } 00244 00245 static vector<mmx_floating> 00246 GLUE_47 (const vector<mmx_floating> &arg_1) { 00247 return tan (arg_1); 00248 } 00249 00250 static vector<mmx_floating> 00251 GLUE_48 (const vector<mmx_floating> &arg_1) { 00252 return acos (arg_1); 00253 } 00254 00255 static vector<mmx_floating> 00256 GLUE_49 (const vector<mmx_floating> &arg_1) { 00257 return asin (arg_1); 00258 } 00259 00260 static vector<mmx_floating> 00261 GLUE_50 (const vector<mmx_floating> &arg_1) { 00262 return atan (arg_1); 00263 } 00264 00265 static vector<mmx_floating> 00266 GLUE_51 (const vector<mmx_floating> &arg_1) { 00267 return abs (arg_1); 00268 } 00269 00270 static shape_axel 00271 GLUE_52 () { 00272 return shape_axel (); 00273 } 00274 00275 static shape_axel 00276 GLUE_53 (const string &arg_1) { 00277 return shape_axel_string (arg_1); 00278 } 00279 00280 static void 00281 GLUE_54 (const shape_axel &arg_1) { 00282 shape_axel_view (arg_1); 00283 } 00284 00285 static shape_point<mmx_floating> 00286 GLUE_55 (const tuple<mmx_floating> &arg_1) { 00287 return shape_point_tuple<mmx_floating > (as_vector (arg_1)); 00288 } 00289 00290 static mmx_floating 00291 GLUE_56 (const shape_point<mmx_floating> &arg_1, const int &arg_2) { 00292 return arg_1[arg_2]; 00293 } 00294 00295 static alias<mmx_floating> 00296 GLUE_57 (const alias<shape_point<mmx_floating> > &arg_1, const int &arg_2) { 00297 return alias_access<mmx_floating > (arg_1, arg_2); 00298 } 00299 00300 static vector<mmx_floating> 00301 GLUE_58 (const shape_point<mmx_floating> &arg_1, const shape_point<mmx_floating> &arg_2) { 00302 return arg_1 - arg_2; 00303 } 00304 00305 static shape_point<mmx_floating> 00306 GLUE_59 (const shape_point<mmx_floating> &arg_1, const vector<mmx_floating> &arg_2) { 00307 return arg_1 + arg_2; 00308 } 00309 00310 static alias<shape_axel> 00311 GLUE_60 (const alias<shape_axel> &arg_1, const shape_point<mmx_floating> &arg_2) { 00312 return alias_write (arg_1, arg_2); 00313 } 00314 00315 void 00316 glue_point_floating () { 00317 static bool done = false; 00318 if (done) return; 00319 done = true; 00320 call_glue (string ("glue_floating")); 00321 define_type<vector<mmx_floating> > (gen (lit ("Vector"), lit ("Floating"))); 00322 define ("vector?", GLUE_1); 00323 define ("vector", GLUE_2); 00324 define ("[]", GLUE_3); 00325 define_converter (":>", GLUE_4, PENALTY_CAST); 00326 define ("#", GLUE_5); 00327 define (".[]", GLUE_6); 00328 define (".[]", GLUE_7); 00329 define (".[]", GLUE_8); 00330 define ("reverse", GLUE_9); 00331 define ("><", GLUE_10); 00332 define ("<<", GLUE_11); 00333 define ("cons", GLUE_12); 00334 define ("car", GLUE_13); 00335 define ("cdr", GLUE_14); 00336 define ("nil?", GLUE_15); 00337 define ("atom?", GLUE_16); 00338 define ("insert", GLUE_17); 00339 define ("find", GLUE_18); 00340 define ("contains?", GLUE_19); 00341 define ("-", GLUE_20); 00342 define ("square", GLUE_21); 00343 define ("+", GLUE_22); 00344 define ("-", GLUE_23); 00345 define ("*", GLUE_24); 00346 define ("+", GLUE_25); 00347 define ("+", GLUE_26); 00348 define ("-", GLUE_27); 00349 define ("-", GLUE_28); 00350 define ("*", GLUE_29); 00351 define ("*", GLUE_30); 00352 define ("dot", GLUE_31); 00353 define ("big_mul", GLUE_32); 00354 define ("big_add", GLUE_33); 00355 define ("/", GLUE_34); 00356 define ("/", GLUE_35); 00357 define ("/", GLUE_36); 00358 define ("<=", GLUE_37); 00359 define (">=", GLUE_38); 00360 define ("<", GLUE_39); 00361 define (">", GLUE_40); 00362 define ("sqrt", GLUE_41); 00363 define ("exp", GLUE_42); 00364 define ("log", GLUE_43); 00365 define ("^", GLUE_44); 00366 define ("cos", GLUE_45); 00367 define ("sin", GLUE_46); 00368 define ("tan", GLUE_47); 00369 define ("arccos", GLUE_48); 00370 define ("arcsin", GLUE_49); 00371 define ("arctan", GLUE_50); 00372 define ("abs", GLUE_51); 00373 define_type<shape_axel > (lit ("Axel")); 00374 define ("axel", GLUE_52); 00375 define ("axel", GLUE_53); 00376 define ("view", GLUE_54); 00377 define_type<shape_point<mmx_floating> > (gen (lit ("Point"), lit ("Floating"))); 00378 define ("point", GLUE_55); 00379 define (".[]", GLUE_56); 00380 define (".[]", GLUE_57); 00381 define ("-", GLUE_58); 00382 define ("+", GLUE_59); 00383 define ("<<", GLUE_60); 00384 } 00385 }