txform.h

Go to the documentation of this file.
00001 
00004 
00005 //
00006 // Copyright (c) 2002-2004 California Institute of Technology
00007 // Copyright (c) 2004-2007 University of Southern California
00008 // Rob Peters <rjpeters at usc dot edu>
00009 //
00010 // created: Fri Jun 21 13:57:32 2002
00011 // commit: $Id: txform.h 10065 2007-04-12 05:54:56Z rjpeters $
00012 // $HeadURL: file:///lab/rjpeters/svnrepo/code/trunk/groovx/src/geom/txform.h $
00013 //
00014 // --------------------------------------------------------------------
00015 //
00016 // This file is part of GroovX.
00017 //   [http://ilab.usc.edu/rjpeters/groovx/]
00018 //
00019 // GroovX is free software; you can redistribute it and/or modify it
00020 // under the terms of the GNU General Public License as published by
00021 // the Free Software Foundation; either version 2 of the License, or
00022 // (at your option) any later version.
00023 //
00024 // GroovX is distributed in the hope that it will be useful, but
00025 // WITHOUT ANY WARRANTY; without even the implied warranty of
00026 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00027 // General Public License for more details.
00028 //
00029 // You should have received a copy of the GNU General Public License
00030 // along with GroovX; if not, write to the Free Software Foundation,
00031 // Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00032 //
00034 
00035 #ifndef GROOVX_GEOM_TXFORM_H_UTC20050626084022_DEFINED
00036 #define GROOVX_GEOM_TXFORM_H_UTC20050626084022_DEFINED
00037 
00038 namespace geom
00039 {
00040   template <class V> class rect;
00041   template <class V> class vec2;
00042   template <class V> class vec3;
00043 
00045   class txform
00046   {
00047   private:
00049 
00053     txform(bool) {}
00054 
00055   public:
00056     txform(const vec3<double>& translation,
00057            const vec3<double>& scaling,
00058            const vec3<double>& rotation_axis,
00059            double rotation_angle);
00060 
00062     static txform identity();
00063 
00065 
00066     static txform random();
00067 
00069     static txform copy_of(const double* data)
00070     { txform r(true); r.set_col_major_data(data); return r; }
00071 
00073     static txform orthographic(const geom::rect<double>& bounds,
00074                                double zNear, double zFar);
00075 
00077     static txform no_init() { return txform(true); }
00078 
00080     geom::txform inverted() const;
00081 
00082     void translate(const vec3<double>& t);
00083     void scale(const vec3<double>& s);
00084     void rotate(const vec3<double>& rotation_axis, double rotation_angle);
00085 
00087     txform mtx_mul(const txform& other) const;
00088 
00090     void transform(const geom::txform& other);
00091 
00092     vec2<double> apply_to(const vec2<double>& input) const;
00093     vec3<double> apply_to(const vec3<double>& input) const;
00094 
00095     const double* col_major_data() const { return &m_mtx[0]; }
00096 
00097     void set_col_major_data(const double* data);
00098 
00099     double  operator[](unsigned int i) const { return m_mtx[i]; }
00100     double& operator[](unsigned int i)       { return m_mtx[i]; }
00101 
00102     void debug_dump() const;
00103 
00105     double debug_sse(const txform& ref) const;
00106 
00107   private:
00108     double m_mtx[16];
00109   };
00110 
00111 } // end namespace geom
00112 
00113 static const char __attribute__((used)) vcid_groovx_geom_txform_h_utc20050626084022[] = "$Id: txform.h 10065 2007-04-12 05:54:56Z rjpeters $ $HeadURL: file:
00114 #endif // !GROOVX_GEOM_TXFORM_H_UTC20050626084022_DEFINED

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