40 #ifndef __MO_MATH_VECTOR4_H__
41 #define __MO_MATH_VECTOR4_H__
58 m_afTuple[0] = afTuple[0];
59 m_afTuple[1] = afTuple[1];
60 m_afTuple[2] = afTuple[2];
61 m_afTuple[3] = afTuple[3];
64 m_afTuple[0] = rkV.m_afTuple[0];
65 m_afTuple[1] = rkV.m_afTuple[1];
66 m_afTuple[2] = rkV.m_afTuple[2];
67 m_afTuple[3] = rkV.m_afTuple[3];
71 inline operator const Real* ()
const {
return m_afTuple; }
72 inline operator Real* () {
return m_afTuple; }
73 inline Real
operator[] (
int i)
const {
return m_afTuple[i]; }
75 inline Real
X ()
const {
return m_afTuple[0]; }
76 inline Real&
X () {
return m_afTuple[0]; }
77 inline Real
Y ()
const {
return m_afTuple[1]; }
78 inline Real&
Y () {
return m_afTuple[1]; }
79 inline Real
Z ()
const {
return m_afTuple[2]; }
80 inline Real&
Z () {
return m_afTuple[2]; }
81 inline Real
W ()
const {
return m_afTuple[3]; }
82 inline Real&
W () {
return m_afTuple[3]; }
87 m_afTuple[0] = rkV.m_afTuple[0];
88 m_afTuple[1] = rkV.m_afTuple[1];
89 m_afTuple[2] = rkV.m_afTuple[2];
90 m_afTuple[3] = rkV.m_afTuple[3];
106 m_afTuple[0]+rkV.m_afTuple[0],
107 m_afTuple[1]+rkV.m_afTuple[1],
108 m_afTuple[2]+rkV.m_afTuple[2],
109 m_afTuple[3]+rkV.m_afTuple[3]);
114 m_afTuple[0]-rkV.m_afTuple[0],
115 m_afTuple[1]-rkV.m_afTuple[1],
116 m_afTuple[2]-rkV.m_afTuple[2],
117 m_afTuple[3]-rkV.m_afTuple[3]);
122 fScalar*m_afTuple[0],
123 fScalar*m_afTuple[1],
124 fScalar*m_afTuple[2],
125 fScalar*m_afTuple[3]);
131 if (fScalar != (Real)0.0)
133 Real fInvScalar = ((Real)1.0)/fScalar;
134 kQuot.m_afTuple[0] = fInvScalar*m_afTuple[0];
135 kQuot.m_afTuple[1] = fInvScalar*m_afTuple[1];
136 kQuot.m_afTuple[2] = fInvScalar*m_afTuple[2];
137 kQuot.m_afTuple[3] = fInvScalar*m_afTuple[3];
161 m_afTuple[0] += rkV.m_afTuple[0];
162 m_afTuple[1] += rkV.m_afTuple[1];
163 m_afTuple[2] += rkV.m_afTuple[2];
164 m_afTuple[3] += rkV.m_afTuple[3];
169 m_afTuple[0] -= rkV.m_afTuple[0];
170 m_afTuple[1] -= rkV.m_afTuple[1];
171 m_afTuple[2] -= rkV.m_afTuple[2];
172 m_afTuple[3] -= rkV.m_afTuple[3];
177 m_afTuple[0] *= fScalar;
178 m_afTuple[1] *= fScalar;
179 m_afTuple[2] *= fScalar;
180 m_afTuple[3] *= fScalar;
185 if (fScalar != (Real)0.0)
187 Real fInvScalar = ((Real)1.0)/fScalar;
188 m_afTuple[0] *= fInvScalar;
189 m_afTuple[1] *= fInvScalar;
190 m_afTuple[2] *= fInvScalar;
191 m_afTuple[3] *= fInvScalar;
208 m_afTuple[0]*m_afTuple[0] +
209 m_afTuple[1]*m_afTuple[1] +
210 m_afTuple[2]*m_afTuple[2] +
211 m_afTuple[3]*m_afTuple[3]);
216 m_afTuple[0]*m_afTuple[0] +
217 m_afTuple[1]*m_afTuple[1] +
218 m_afTuple[2]*m_afTuple[2] +
219 m_afTuple[3]*m_afTuple[3];
224 m_afTuple[0]*rkV.m_afTuple[0] +
225 m_afTuple[1]*rkV.m_afTuple[1] +
226 m_afTuple[2]*rkV.m_afTuple[2] +
227 m_afTuple[3]*rkV.m_afTuple[3];
231 Real fLength = Length();
235 Real fInvLength = ((Real)1.0)/fLength;
236 m_afTuple[0] *= fInvLength;
237 m_afTuple[1] *= fInvLength;
238 m_afTuple[2] *= fInvLength;
239 m_afTuple[3] *= fInvLength;
244 m_afTuple[0] = (Real)0.0;
245 m_afTuple[1] = (Real)0.0;
246 m_afTuple[2] = (Real)0.0;
247 m_afTuple[3] = (Real)0.0;
258 if ((0 < l) && (0 < lv))
return Dot(rkV) / (l * lv);
277 int CompareArrays (
const moVector4 & rkV)
const {
278 return memcmp(m_afTuple,rkV.m_afTuple,4*
sizeof(Real));
286 template <
class Real>
289 moVector4<Real> v4(fScalar*rkV[0], fScalar*rkV[1], fScalar*rkV[2], fScalar*rkV[3]);
moVector4< Real > operator*(Real fScalar, const moVector4< Real > &rkV)
bool operator<=(const moMatrix3 &rkM) const
moVector4< MOlong > moVector4i
moVector4< MOfloat > moVector4f
moMatrix3 operator-(const moMatrix3 &rkM) const
static Real ACos(Real fValue)
moMatrix3 operator/(Real fScalar) const
bool operator>(const moMatrix3 &rkM) const
moVector4(const Real *afTuple)
Real Angle(const moVector4< Real > &rkV)
static const moVector4 ZERO
Clase base abstracta de donde deben derivar los objetos [virtual pura].
static const moVector4 UNIT_Y
Real SquaredLength() const
static const moVector4 UNIT_X
static const moVector4 ONE
moMatrix3 & operator-=(const moMatrix3 &rkM)
bool operator==(const moMatrix3 &rkM) const
static Real Sqrt(Real fValue)
bool operator<(const moMatrix3 &rkM) const
moDeclareExportedDynamicArray(moVector4i, moVector4iArray)
moMatrix3 & operator/=(Real fScalar)
static const moVector4 UNIT_W
bool operator!=(const moMatrix3 &rkM) const
moMatrix3 & operator*=(Real fScalar)
bool operator>=(const moMatrix3 &rkM) const
moVector4(const moVector4 &rkV)
moMatrix3 & operator=(const moMatrix3 &rkM)
static const moVector4 UNIT_Z
moVector4(Real fX, Real fY, Real fZ, Real fW)
Real Dot(const moVector4 &rkV) const
moVector4< MOdouble > moVector4d
moMatrix3 operator+(const moMatrix3 &rkM) const
moMatrix3 & operator+=(const moMatrix3 &rkM)
Real Cosine(const moVector4< Real > &rkV)
const Real * operator[](int iRow) const