Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

vectorc.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 1999  Carsten Winkelholz
00003 
00004 Address:  FGAN Forschungsgesellschaft fr Angewandte Naturwissenschaften e. V.
00005       Neuenahrer Str. 20
00006       D - 53343 Wachtberg
00007       
00008 Email:    winkelholz@fgan.de
00009 
00010 This program is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 This program is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00023 */
00024 
00025 
00026 #ifndef VECTOR3C_H
00027 #define VECTOR3C_H
00028 
00029 #include <math.h>
00030 #include <fstream>
00031 
00032 #include "../oawconfig.h"
00033 
00034 OAW_BEGIN_NAMESPACE
00035 
00036 class OAW_DLLMAPPING Vector3C 
00037 {   
00038 public:
00039   Vector3C(){x=0;y=0;z=0;}
00040   Vector3C(double x, double y, double z);
00041   Vector3C(double* v){x=v[0];y=v[1];z=v[2];}
00042   Vector3C(float* v){x=v[0];y=v[1];z=v[2];}
00043   ~Vector3C() {}
00044   inline double& operator [](long i){return ((double*)this)[i];} 
00045   void Set(double xx,double yy,double zz){ x=xx;y=yy;z=zz;}
00046   void Rotate(const Vector3C& ri,double om);
00047   void Rotate(const Vector3C& ri,const Vector3C& ap,double om);
00048   int operator == (const Vector3C&);  
00049   int operator != (const Vector3C&);
00050   Vector3C& operator = (const Vector3C&);  
00051   Vector3C& operator += (const Vector3C&);  
00052   Vector3C& operator -= (const Vector3C&);  
00053   Vector3C operator  - (const Vector3C&);
00054   Vector3C operator  + (const Vector3C&);
00055   double operator * (const Vector3C&); 
00056   Vector3C operator * (double);
00057   friend OAW_DLLMAPPING Vector3C operator * (double a,const Vector3C &A); 
00058   friend OAW_DLLMAPPING Vector3C operator + (const Vector3C &A,const Vector3C &B); 
00059   friend OAW_DLLMAPPING Vector3C operator - (const Vector3C &A,const Vector3C &B); 
00060   void vkrp(const Vector3C&,const Vector3C&) ;
00061   double Normalize();
00062   double Length();
00063   void Write() const;
00064   void Writeln() const;
00065 public:    
00066   double x,y,z;
00067 }; 
00068 
00069 class OAW_DLLMAPPING Vector2C{
00070 public:
00071   Vector2C();
00072   Vector2C(const double&,const double&);
00073   Vector2C(float* v){x=v[0];y=v[1];}
00074   Vector2C(double* v){x=v[0];y=v[1];}
00075   inline double& operator [](long i){return ((double*)this)[i];} 
00076   void Set(double xx,double yy){ x=xx;y=yy;}
00077   int operator == (const Vector2C&);  
00078   int operator != (const Vector2C&);  
00079   Vector2C& operator = (const Vector2C&);  
00080   Vector2C& operator += (const Vector2C&);  
00081   Vector2C& operator -= (const Vector2C&);  
00082   Vector2C operator  - (const Vector2C&);
00083   Vector2C operator  + (const Vector2C&);
00084   double operator * (const Vector2C&); 
00085   Vector2C operator * (double);
00086   friend OAW_DLLMAPPING Vector2C operator * (double a,const Vector2C &A); 
00087 public:
00088   double x,y;
00089 };
00090 
00091 class OAW_DLLMAPPING Vector4C{
00092 public:
00093   Vector4C(const double&,const double&,const double&,const double&);
00094   Vector4C();
00095   inline double& operator [](long i){return ((double*)this)[i];} 
00096   void Set(double xx,double yy,double zz,double ww){ x=xx;y=yy;z=zz;w=ww;}
00097   int operator != (const Vector4C&);
00098   int operator == (const Vector4C&);  
00099   Vector4C& operator = (const Vector4C&);  
00100   Vector4C& operator += (const Vector4C&);  
00101   Vector4C& operator -= (const Vector4C&);  
00102   Vector4C operator  - (const Vector4C&);
00103   Vector4C operator  + (const Vector4C&);
00104   double operator * (const Vector4C&); 
00105   Vector4C operator * (double);
00106   void Write() const;
00107   void Writeln() const;
00108 public:
00109   double x,y,z,w;
00110 };
00111 
00112 OAW_DLLMAPPING double Norm(const Vector3C& v);
00113 OAW_DLLMAPPING Vector3C vkrp(const Vector3C&,const Vector3C&) ;
00114 OAW_DLLMAPPING double Angle(const Vector3C&,const Vector3C&) ;
00115 OAW_DLLMAPPING double AngleTo(const Vector3C&,const Vector3C&, const Vector3C&) ;
00116 OAW_DLLMAPPING double operator * (const Vector3C&,const Vector3C&);
00117 OAW_DLLMAPPING Vector3C operator - (const Vector3C&,const Vector3C&);
00118 OAW_DLLMAPPING Vector4C operator * (const double&,const Vector4C&);
00119 
00120 typedef  Vector3C*  pVectorC;
00121 typedef  Vector3C   VectorC;
00122 
00123 OAW_END_NAMESPACE
00124 
00125 #endif
00126 
00127 
00128 
00129 

Generated on Tue Jul 29 14:24:15 2003 for Open ActiveWrl by doxygen1.3-rc2