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

vector4.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:19 $
00024 // By           :       $Author: kolrabi $
00025 // $Id: vector4.h,v 1.1.1.1 2002/12/07 19:02:19 kolrabi Exp $ 
00026 
00027 /*
00028 
00029   $Log: vector4.h,v $
00030   Revision 1.1.1.1  2002/12/07 19:02:19  kolrabi
00031   initial release
00032 
00033 
00034 */
00035 
00042 /**************************************************************************** 
00043  **************************************************************************** 
00044  * FUNCTIONS **************************************************************** 
00045  **************************************************************************** 
00046  ****************************************************************************/ 
00047  
00048 #ifndef OMICRON_VECTOR4_DEFINED
00049 #define OMICRON_VECTOR4_DEFINED
00050  
00051 class vec4_c
00053 {
00054 protected:
00055 
00056     vec4_t          vec;                
00057 
00058 public:
00059 
00060     static const vec4_t          vec4x;
00061     static const vec4_t          vec4y;
00062     static const vec4_t          vec4z;
00063     static const vec4_t          vec4w;
00064     static const vec4_t          vec40;
00065 
00066     vec4_c();                           
00067     vec4_c(const vec4_c &);             
00068     vec4_c(const vec4_t);               
00069     vec4_c(float, float, float, float); 
00070 
00071     virtual ~vec4_c();                  
00072 
00073     operator const float *();           
00074 
00075     void
00076     set
00078     ( 
00079         float               x,          
00080         float               y,
00081         float               z,
00082         float               w
00083     );
00084 
00085     void
00086     set_component
00087     (
00088         int                 n,
00089         float               x
00090     );
00091 
00092     void
00093     clear
00095     ();
00096 
00097     float 
00098     length
00102     ();
00103 
00104     float
00105     length_squared             
00109     ();
00110 
00111     // ******************************************************************* //
00112     // OPERATIONS (OPERATORS, CROSSPRODUCT ETC)
00113 
00114     vec4_c                              
00115     operator -(const vec4_t);
00116 
00117     vec4_c
00118     operator +(const vec4_t);           
00119 
00120     vec4_c
00121     operator *(float);                  
00122 
00123     vec4_c                              
00124     operator *(const vec4_t);
00125 
00126     vec4_c                              
00127     operator =(const vec4_t);
00128 
00129     bool                                
00130     operator ==(const vec4_t);
00131 
00132     vec4_c
00133     ma
00136     ( 
00137         const vec_t         s,              
00138         const vec4_t        vb              
00139     );
00140 
00141     vec4_c
00142     ma_vec
00144     (
00145         const vec4_t        s,              
00146         const vec4_t        vb              
00147     );
00148 
00149     vec4_c
00150     normalize();
00151 
00152 /*
00153     vec4_c
00154     cross                    
00156     ( 
00157         const vec4_t        v
00158     );
00159 */
00160 
00161     float
00162     dot
00164     ( 
00165         const vec4_t        v
00166     );
00167 
00168     // ******************************************************************* //
00169     // PROJECTION
00170 
00171 /*    vec4_c
00172     rotate
00174     ( 
00175         const vec_t         angle           
00176     );
00177 
00178     vec4_c
00179     perpendicular               
00182     ( 
00183     );
00184 */
00185     void copy(vec4_t out)
00186     {
00187         out[0] = vec[0];
00188         out[1] = vec[1];
00189         out[2] = vec[2];
00190         out[3] = vec[3];
00191     }
00192 
00193     // ******************************************************************* //
00194     // STATIC
00195 
00196     static vec4_c
00197     hermite
00200     ( 
00201         const vec4_t        p1,             
00202         const vec4_t        t1,             
00203         const vec4_t        p2,             
00204         const vec4_t        t2,             
00205         const float         frac            
00206     );
00207 
00208     static vec4_c
00209     linear
00212     ( 
00213         const vec4_t        p1,             
00214         const vec4_t        p2,             
00215         const float         frac            
00216     );
00217 };
00218 
00219 #endif
00220 
00221 

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