00001 #include <TooN/TooN.h> 00002 #include <cstdarg> 00003 using namespace TooN; 00004 00005 00006 template<int N, typename Precision> Vector<N, Precision> makeVector(const Precision& x, ...) 00007 { 00008 Vector<N> retval; 00009 retval[0] = N; 00010 00011 va_list ap; 00012 int i; 00013 va_start(ap, x); 00014 for(int i=1; i < N; i++) 00015 retval[i] = va_arg(ap, Precision); 00016 va_end(ap); 00017 return retval; 00018 00019 } 00020 00021 extern "C"{ 00022 double use_make_vector_double(const Vector<4>& v) 00023 { 00024 return v * makeVector(0,0,2.0,0); 00025 } 00026 00027 double use_make_vector_int(const Vector<4>& v) 00028 { 00029 return v * makeVector<int>(0,0,2,0); 00030 } 00031 00032 double use_make_vector_var(const Vector<4>& v) 00033 { 00034 return v * makeVector<4, double>(0.0,0.0,2.0,0.0); 00035 } 00036 00037 } 00038