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
moMathVector4.cpp
Go to the documentation of this file.
1 /*******************************************************************************
2 
3  moMathVector4.cpp
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 "moMathVector4.h"
39 
40 #include "moArray.h"
41 moDefineDynamicArray(moVector4iArray)
42 moDefineDynamicArray(moVector4fArray)
43 moDefineDynamicArray(moVector4dArray)
44 
45 // moVector4 class ------------------------------------------------------------
46 /*
47 template <class Real>
48 moVector4<Real>::moVector4 ()
49 {
50  // uninitialized for performance in array construction
51 }
52 
53 template <class Real>
54 moVector4<Real>::moVector4 (Real fX, Real fY, Real fZ, Real fW)
55 {
56  m_afTuple[0] = fX;
57  m_afTuple[1] = fY;
58  m_afTuple[2] = fZ;
59  m_afTuple[3] = fW;
60 }
61 
62 template <class Real>
63 moVector4<Real>::moVector4 (const Real* afTuple)
64 {
65  m_afTuple[0] = afTuple[0];
66  m_afTuple[1] = afTuple[1];
67  m_afTuple[2] = afTuple[2];
68  m_afTuple[3] = afTuple[3];
69 }
70 
71 template <class Real>
72 moVector4<Real>::moVector4 (const moVector4& rkV) : moAbstract(rkV)
73 {
74  m_afTuple[0] = rkV.m_afTuple[0];
75  m_afTuple[1] = rkV.m_afTuple[1];
76  m_afTuple[2] = rkV.m_afTuple[2];
77  m_afTuple[3] = rkV.m_afTuple[3];
78 }
79 
80 template <class Real>
81 int moVector4<Real>::CompareArrays (const moVector4& rkV) const
82 {
83  return memcmp(m_afTuple,rkV.m_afTuple,4*sizeof(Real));
84 }
85 
86 template <class Real>
87 bool moVector4<Real>::operator== (const moVector4& rkV) const
88 {
89  return CompareArrays(rkV) == 0;
90 }
91 
92 template <class Real>
93 bool moVector4<Real>::operator!= (const moVector4& rkV) const
94 {
95  return CompareArrays(rkV) != 0;
96 }
97 
98 template <class Real>
99 bool moVector4<Real>::operator< (const moVector4& rkV) const
100 {
101  return CompareArrays(rkV) < 0;
102 }
103 
104 template <class Real>
105 bool moVector4<Real>::operator<= (const moVector4& rkV) const
106 {
107  return CompareArrays(rkV) <= 0;
108 }
109 
110 template <class Real>
111 bool moVector4<Real>::operator> (const moVector4& rkV) const
112 {
113  return CompareArrays(rkV) > 0;
114 }
115 
116 template <class Real>
117 bool moVector4<Real>::operator>= (const moVector4& rkV) const
118 {
119  return CompareArrays(rkV) >= 0;
120 }
121 */
122 template<> const moVector4<MOlong> moVector4<MOlong>::ZERO(0,0,0,0);
123 template<> const moVector4<MOlong> moVector4<MOlong>::UNIT_X(1,0,0,0);
124 template<> const moVector4<MOlong> moVector4<MOlong>::UNIT_Y(0,1,0,0);
125 template<> const moVector4<MOlong> moVector4<MOlong>::UNIT_Z(0,0,1,0);
126 template<> const moVector4<MOlong> moVector4<MOlong>::UNIT_W(0,0,0,1);
127 template<> const moVector4<MOlong> moVector4<MOlong>::ONE(1,1,1,1);
128 
129 template<> const moVector4<MOfloat> moVector4<MOfloat>::ZERO(0.0f,0.0f,0.0f,0.0f);
130 template<> const moVector4<MOfloat> moVector4<MOfloat>::UNIT_X(1,0.0f,0.0f,0.0f);
131 template<> const moVector4<MOfloat> moVector4<MOfloat>::UNIT_Y(0.0f,1,0.0f,0.0f);
132 template<> const moVector4<MOfloat> moVector4<MOfloat>::UNIT_Z(0.0f,0.0f,1,0.0f);
133 template<> const moVector4<MOfloat> moVector4<MOfloat>::UNIT_W(0.0f,0.0f,0.0f,1);
134 template<> const moVector4<MOfloat> moVector4<MOfloat>::ONE(1,1,1,1);
135 
136 template<> const moVector4<MOdouble> moVector4<MOdouble>::ZERO(0.0,0.0,0.0,0.0);
137 template<> const moVector4<MOdouble> moVector4<MOdouble>::UNIT_X(1.0,0.0,0.0,0.0);
138 template<> const moVector4<MOdouble> moVector4<MOdouble>::UNIT_Y(0.0,1.0,0.0,0.0);
139 template<> const moVector4<MOdouble> moVector4<MOdouble>::UNIT_Z(0.0,0.0,1.0,0.0);
140 template<> const moVector4<MOdouble> moVector4<MOdouble>::UNIT_W(0.0,0.0,0.0,1.0);
141 template<> const moVector4<MOdouble> moVector4<MOdouble>::ONE(1.0,1.0,1.0,1.0);
142 
#define MOfloat
Definition: moTypes.h:403
#define MOlong
Definition: moTypes.h:391
#define moDefineDynamicArray(name)
Definition: moArray.cpp:222
#define MOdouble
Definition: moTypes.h:404