vectcl.h

Go to the documentation of this file.
00001 
00003 
00004 //
00005 // Copyright (c) 2004-2007 University of Southern California
00006 // Rob Peters <rjpeters at usc dot edu>
00007 //
00008 // created: Sat Nov 20 14:06:16 2004
00009 // commit: $Id: vectcl.h 10065 2007-04-12 05:54:56Z rjpeters $
00010 // $HeadURL: file:///lab/rjpeters/svnrepo/code/trunk/groovx/src/tcl-gfx/vectcl.h $
00011 //
00012 // --------------------------------------------------------------------
00013 //
00014 // This file is part of GroovX.
00015 //   [http://ilab.usc.edu/rjpeters/groovx/]
00016 //
00017 // GroovX is free software; you can redistribute it and/or modify it
00018 // under the terms of the GNU General Public License as published by
00019 // the Free Software Foundation; either version 2 of the License, or
00020 // (at your option) any later version.
00021 //
00022 // GroovX is distributed in the hope that it will be useful, but
00023 // WITHOUT ANY WARRANTY; without even the implied warranty of
00024 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00025 // General Public License for more details.
00026 //
00027 // You should have received a copy of the GNU General Public License
00028 // along with GroovX; if not, write to the Free Software Foundation,
00029 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00030 //
00032 
00033 #ifndef GROOVX_GFX_VECTCL_H_UTC20050626084023_DEFINED
00034 #define GROOVX_GFX_VECTCL_H_UTC20050626084023_DEFINED
00035 
00036 #include "geom/vec2.h"
00037 #include "geom/vec3.h"
00038 
00039 #include "tcl/conversions.h"
00040 #include "tcl/list.h"
00041 
00042 namespace tcl
00043 {
00045   template <class T>
00046   inline geom::vec2<T> aux_convert_to(Tcl_Obj* obj, geom::vec2<T>*)
00047   {
00048     tcl::list listObj(obj);
00049 
00050     return geom::vec2<T>(listObj.template get<T>(0),
00051                          listObj.template get<T>(1));
00052   }
00053 
00055   template <class T>
00056   inline tcl::obj aux_convert_from( const geom::vec2<T>& v )
00057   {
00058     tcl::list listObj;
00059     listObj.append(v.x());
00060     listObj.append(v.y());
00061     return listObj.as_obj();
00062   }
00063 
00065   template <class T>
00066   inline geom::vec3<T> aux_convert_to(Tcl_Obj* obj, geom::vec3<T>*)
00067   {
00068     tcl::list listObj(obj);
00069 
00070     return geom::vec3<T>(listObj.template get<T>(0),
00071                          listObj.template get<T>(1),
00072                          listObj.template get<T>(2));
00073   }
00074 
00076   template <class T>
00077   inline tcl::obj aux_convert_from( const geom::vec3<T>& v )
00078   {
00079     tcl::list listObj;
00080     listObj.append(v.x());
00081     listObj.append(v.y());
00082     listObj.append(v.z());
00083     return listObj.as_obj();
00084   }
00085 }
00086 
00087 static const char __attribute__((used)) vcid_groovx_gfx_vectcl_h_utc20050626084023[] = "$Id: vectcl.h 10065 2007-04-12 05:54:56Z rjpeters $ $HeadURL: file:
00088 #endif // !GROOVX_GFX_VECTCL_H_UTC20050626084023_DEFINED

The software described here is Copyright (c) 1998-2005, Rob Peters.
This page was generated Wed Dec 3 06:49:41 2008 by Doxygen version 1.5.5.