libmoldeo (Moldeo 1.0 Core)  1.0
libmoldeo is the group of objects and functions that executes the basic operations of Moldeo 1.0 Platform.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
moMathDVector.h
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  moMathDVector.h
4 
5  ****************************************************************************
6  * *
7  * This source is free software; you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation; either version 2 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This code is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
15  * General Public License for more details. *
16  * *
17  * A copy of the GNU General Public License is available on the World *
18  * Wide Web at <http://www.gnu.org/copyleft/gpl.html>. You can also *
19  * obtain it by writing to the Free Software Foundation, *
20  * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21  * *
22  ****************************************************************************
23 
24  Copyright(C) 2006 Fabricio Costa
25 
26  Authors:
27  Fabricio Costa
28  Andrés Colubri
29 
30  Portions taken from
31  Wild Magic Source Code
32  David Eberly
33  http://www.geometrictools.com
34  Copyright (c) 1998-2007
35 
36 *******************************************************************************/
37 
38 #include "moMath.h"
39 
40 #ifndef __MO_MATH_DVECTOR_H__
41 #define __MO_MATH_DVECTOR_H__
42 
43 template <class Real>
45 {
46 public:
47  // construction
48  moDVector (int iSize = 0);
49  moDVector (int iSize, const Real* afTuple);
50  moDVector (const moDVector& rkV);
51  ~moDVector ();
52 
53  // coordinate access
54  void SetSize (int iSize);
55  int GetSize () const;
56  operator const Real* () const;
57  operator Real* ();
58  Real operator[] (int i) const;
59  Real& operator[] (int i);
60 
61  // assignment
62  moDVector& operator= (const moDVector& rkV);
63 
64  // comparison
65  bool operator== (const moDVector& rkV) const;
66  bool operator!= (const moDVector& rkV) const;
67  bool operator< (const moDVector& rkV) const;
68  bool operator<= (const moDVector& rkV) const;
69  bool operator> (const moDVector& rkV) const;
70  bool operator>= (const moDVector& rkV) const;
71 
72  // arithmetic operations
73  moDVector operator+ (const moDVector& rkV) const;
74  moDVector operator- (const moDVector& rkV) const;
75  moDVector operator* (Real fScalar) const;
76  moDVector operator/ (Real fScalar) const;
77  moDVector operator- () const;
78 
79  // arithmetic updates
80  moDVector& operator+= (const moDVector& rkV);
81  moDVector& operator-= (const moDVector& rkV);
82  moDVector& operator*= (Real fScalar);
83  moDVector& operator/= (Real fScalar);
84 
85  // vector operations
86  Real Length () const;
87  Real SquaredLength () const;
88  Real Dot (const moDVector& rkV) const;
89  Real Normalize ();
90 
91 protected:
92  // support for comparisons
93  int CompareArrays (const moDVector& rkV) const;
94 
95  int m_iSize;
96  Real* m_afTuple;
97 };
98 
99 template <class Real>
100 moDVector<Real> operator* (Real fScalar, const moDVector<Real>& rkV);
101 
102 #ifndef MO_MACOSX
103 #ifndef MO_RASPBIAN
105 #endif
106 #endif
107 typedef moDVector<MOfloat> moDVectorf;
108 
109 #ifndef MO_MACOSX
110 #ifndef MO_RASPBIAN
112 #endif
113 #endif
114 typedef moDVector<MOdouble> moDVectord;
115 
116 
117 #endif
118 
bool operator<=(const moMatrix3 &rkM) const
Definition: moMathMatrix.h:960
moMatrix3 operator-(const moMatrix3 &rkM) const
moMatrix3 operator/(Real fScalar) const
bool operator>(const moMatrix3 &rkM) const
Definition: moMathMatrix.h:966
moDVector< MOdouble > moDVectord
Clase base abstracta de donde deben derivar los objetos [virtual pura].
Definition: moAbstract.h:191
#define LIBMOLDEO_API
Definition: moTypes.h:180
Real * m_afTuple
Definition: moMathDVector.h:96
moMatrix3 & operator-=(const moMatrix3 &rkM)
bool operator==(const moMatrix3 &rkM) const
Definition: moMathMatrix.h:942
bool operator<(const moMatrix3 &rkM) const
Definition: moMathMatrix.h:954
moMatrix3 & operator/=(Real fScalar)
bool operator!=(const moMatrix3 &rkM) const
Definition: moMathMatrix.h:948
moMatrix3 & operator*=(Real fScalar)
bool operator>=(const moMatrix3 &rkM) const
Definition: moMathMatrix.h:972
moMatrix3 & operator=(const moMatrix3 &rkM)
moMatrix3 operator+(const moMatrix3 &rkM) const
moDVector< Real > operator*(Real fScalar, const moDVector< Real > &rkV)
moMatrix3 & operator+=(const moMatrix3 &rkM)
const Real * operator[](int iRow) const
moDVector< MOfloat > moDVectorf