Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

vector2.h

Go to the documentation of this file.
00001 // OMICRON ENGINE HEADER FILE
00002 //
00003 // --------------------------------------------------------------------------
00004 // Copyright (C) 2001-2002 by Bjoern Paetzel <kolrabi@gmx.de>
00005 //
00006 // This file is part of the Omicron Engine.
00007 //
00008 // The Omicron Engine is free software; you can redistribute it and/or modify
00009 // it under the terms of the  GNU General Public License  as published by the
00010 // Free Software Foundation;  either version  2  of the License,  or (at your
00011 // option) any later version.
00012 //
00013 // The Omicron Engine  is distributed in the hope that it will be useful, but
00014 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
00015 // or  FITNESS FOR A PARTICULAR PURPOSE.  See the  GNU General Public License
00016 // for more details.
00017 //
00018 // You should have  received a copy of the  GNU General Public License  along
00019 // with The Omicron Engine;  if not,  write to the  Free Software Foundation,
00020 // Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
00021 //
00022 // --------------------------------------------------------------------------
00023 // Last modified:       $Date: 2002/12/07 19:02:18 $
00024 // By           :       $Author: kolrabi $
00025 // $Id: vector2.h,v 1.1.1.1 2002/12/07 19:02:18 kolrabi Exp $ 
00026 
00027 /*
00028 
00029   $Log: vector2.h,v $
00030   Revision 1.1.1.1  2002/12/07 19:02:18  kolrabi
00031   initial release
00032 
00033 
00034 */
00035 
00042 /**************************************************************************** 
00043  **************************************************************************** 
00044  * FUNCTIONS **************************************************************** 
00045  **************************************************************************** 
00046  ****************************************************************************/ 
00047 
00048 #ifndef OMICRON_VECTOR2_DEFINED
00049 #define OMICRON_VECTOR2_DEFINED
00050  
00051 class vec2_c
00053 {
00054 protected:
00055 
00056     vec2_t          vec;                
00057 
00058 public:
00059 
00060     static const vec2_t          vec2x;
00061     static const vec2_t          vec2y;
00062     static const vec2_t          vec20;
00063 
00064     vec2_c();                           
00065     vec2_c(const vec2_c &);             
00066     vec2_c(const vec2_t);               
00067     vec2_c(float, float);               
00068 
00069     virtual ~vec2_c();                  
00070 
00071     operator const float *();           
00072 
00073     void
00074     set
00076     ( 
00077         float               x,          
00078         float               y
00079     );
00080 
00081     void
00082     set_component
00083     (
00084         int                 n,
00085         float               x
00086     );
00087 
00088     void
00089     clear
00091     ();
00092 
00093     float 
00094     length
00098     ();
00099 
00100     float
00101     length_squared             
00105     ();
00106 
00107     // ******************************************************************* //
00108     // OPERATIONS (OPERATORS, CROSSPRODUCT ETC)
00109 
00110     vec2_c                              
00111     operator -(const vec2_t);
00112 
00113     vec2_c
00114     operator +(const vec2_t);           
00115 
00116     vec2_c
00117     operator *(float);                  
00118 
00119     vec2_c                              
00120     operator *(const vec2_t);
00121 
00122     vec2_c                              
00123     operator =(const vec2_t);
00124 
00125     bool                                
00126     operator ==(const vec2_t);
00127 
00128     vec2_c
00129     ma
00132     ( 
00133         const vec_t         s,              
00134         const vec2_t        vb              
00135     );
00136 
00137     vec2_c
00138     ma_vec
00140     (
00141         const vec2_t        s,              
00142         const vec2_t        vb              
00143     );
00144 
00145     vec2_c
00146     normalize();
00147 
00148     vec2_c
00149     cross                    
00151     ( 
00152         const vec2_t        v
00153     );
00154 
00155     float
00156     dot
00158     ( 
00159         const vec2_t        v
00160     );
00161 
00162     // ******************************************************************* //
00163     // PROJECTION
00164 
00165     vec2_c
00166     rotate
00168     ( 
00169         const vec_t         angle           
00170     );
00171 
00172     vec2_c
00173     perpendicular               
00176     ( 
00177     );
00178 
00179     void copy(vec2_t out)
00180     {
00181         out[0] = vec[0];
00182         out[1] = vec[1];
00183     }
00184 
00185     // ******************************************************************* //
00186     // STATIC
00187 
00188     static vec2_c
00189     hermite
00192     ( 
00193         const vec2_t        p1,             
00194         const vec2_t        t1,             
00195         const vec2_t        p2,             
00196         const vec2_t        t2,             
00197         const float         frac            
00198     );
00199 
00200     static vec2_c
00201     linear
00204     ( 
00205         const vec2_t        p1,             
00206         const vec2_t        p2,             
00207         const float         frac            
00208     );
00209 };
00210 
00211 #endif

Generated on Wed Dec 18 15:48:48 2002 for omicron engine by doxygen1.2.18