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

vector.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001 The AUTHORS 
00003  *   Romeu Andre' Pieritz, Ph.D.        - romeu_pieritz@hotmail.com
00004  *   Rafael Mendes, Eng.                – mendes_rafael@yahoo.com
00005  *   Rodrigo Ferraz de Andrade, Eng.    – rferraz@iname.com 
00006  * All rights reserved.
00007  *
00008  * Permission to use, copy and distribute this software and its
00009  * documentation for educational and personal use, without fee is hereby granted, 
00010  * provided that the above copyright notice and the following
00011  * two paragraphs appear in all copies of this software.
00012  *
00013  * IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR
00014  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
00015  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHORS
00016  * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00017  *
00018  * THE AUTHORS SPECIFICALLY DISCLAIMS ANY WARRANTIES,
00019  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
00020  * AND FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HERE UNDER IS
00021  * ON AN "AS IS" BASIS, AND THE AUTHORS HAVE NO OBLIGATION TO
00022  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
00023  *
00024  * SINMEC Lab. - CFD Sinflow Project - http://www.sinmec.ufsc.br/cfd
00025  */
00026 
00027 
00028 // File Define
00029 #ifndef __CSFL_FIELD_CORE_VECTOR_H__
00030 #define __CSFL_FIELD_CORE_VECTOR_H__
00031 
00032 // Include 
00033 #include <csfl/sys/core/sflobject.h>
00034 #include <csfl/sys/geom/dpoint.h>
00035 
00036 
00037 // Namespace
00038 namespace csfl {
00039 
00040 
00041 class IVector : 
00042         virtual public ISFLObject
00043 
00047 
00048 {
00049 
00050 public:
00051 
00055         IVector( double _x , double _y ) : 
00056           ISFLObject(), x( _x ), y( _y ) {}
00057 
00061         IVector( const IDPoint &_p ) : 
00062           ISFLObject(), x( _p.x ), y( _p.y ) {}
00063         
00067         IVector( const IVector &_v ) : 
00068           ISFLObject(), x( _v.x ), y( _v.y ) {}
00069     IVector() {}
00070 
00075         double InnerProduct( IVector v ) const
00076                 { return ( x*v.x + y*v.y ); }
00077         
00082         double CrossProduct( IVector v ) const
00083                 { return ::fabs( x*v.y - y*v.x ); }
00084 
00086         double Norm() const
00087                 { return ::sqrt( x*x + y*y ); }
00088 
00090         IVector operator + ( IVector v ) const
00091                 { return IVector( x + v.x, y + v.y ); }
00092 
00094         IVector operator - ( IVector v ) const
00095                 { return IVector( x - v.x, y - v.y ); }
00096 
00098         IVector operator * ( int c ) const
00099                 { return IVector( c*x, c*y ); }
00100 
00101 public:
00102         double x, y;
00103 };
00104 
00105 } // csfl namespace
00106 
00107 #endif // __CSFL_FIELD_CORE_VECTOR_H__

 

CFD Project | Documents | Downloads | Contact us | Use Terms

 

© SINMEC/EMC/UFSC, 2001.

All rights reserved.

Last Update: Jan. 18, 2002

 Webmaster