tf2 rolling
tf2 maintains the relationship between coordinate frames in a tree structure buffered in time, and lets the user transform points, vectors, etc between any two coordinate frames at any desired point in time.
Loading...
Searching...
No Matches
QuadWord.hpp
Go to the documentation of this file.
1/*
2Copyright (c) 2003-2006 Gino van den Bergen / Erwin Coumans http://continuousphysics.com/Bullet/
3
4This software is provided 'as-is', without any express or implied warranty.
5In no event will the authors be held liable for any damages arising from the use of this software.
6Permission is granted to anyone to use this software for any purpose,
7including commercial applications, and to alter it and redistribute it freely,
8subject to the following restrictions:
9
101. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
112. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
123. This notice may not be removed or altered from any source distribution.
13*/
14
15
16#ifndef TF2__LINEARMATH__QUADWORD_HPP
17#define TF2__LINEARMATH__QUADWORD_HPP
18
19#include "Scalar.hpp"
20#include "MinMax.hpp"
22
23
24#if defined (__CELLOS_LV2) && defined (__SPU__)
25#include <altivec.h>
26#endif
27
28namespace tf2
29{
33#ifndef USE_LIBSPE2
35#else
36class QuadWord
37#endif
38{
39protected:
40
41#if defined (__SPU__) && defined (__CELLOS_LV2__)
42 union {
45 };
46public:
48 vec_float4 get128() const
49 {
50 return mVec128;
51 }
52protected:
53#else //__CELLOS_LV2__ __SPU__
55#endif //__CELLOS_LV2__ __SPU__
56
57 public:
58
59
61 TF2SIMD_FORCE_INLINE const tf2Scalar& getX() const { return m_floats[0]; }
63 TF2SIMD_FORCE_INLINE const tf2Scalar& getY() const { return m_floats[1]; }
65 TF2SIMD_FORCE_INLINE const tf2Scalar& getZ() const { return m_floats[2]; }
75 TF2SIMD_FORCE_INLINE const tf2Scalar& x() const { return m_floats[0]; }
77 TF2SIMD_FORCE_INLINE const tf2Scalar& y() const { return m_floats[1]; }
79 TF2SIMD_FORCE_INLINE const tf2Scalar& z() const { return m_floats[2]; }
81 TF2SIMD_FORCE_INLINE const tf2Scalar& w() const { return m_floats[3]; }
82
83 //TF2SIMD_FORCE_INLINE tf2Scalar& operator[](int i) { return (&m_floats[0])[i]; }
84 //TF2SIMD_FORCE_INLINE const tf2Scalar& operator[](int i) const { return (&m_floats[0])[i]; }
86 TF2SIMD_FORCE_INLINE operator tf2Scalar *() { return &m_floats[0]; }
87 TF2SIMD_FORCE_INLINE operator const tf2Scalar *() const { return &m_floats[0]; }
88
90 {
91 return ((m_floats[3]==other.m_floats[3]) && (m_floats[2]==other.m_floats[2]) && (m_floats[1]==other.m_floats[1]) && (m_floats[0]==other.m_floats[0]));
92 }
93
95 {
96 return !(*this == other);
97 }
98
105 {
106 m_floats[0]=x;
107 m_floats[1]=y;
108 m_floats[2]=z;
109 m_floats[3] = 0.f;
110 }
111
112/* void getValue(tf2Scalar *m) const
113 {
114 m[0] = m_floats[0];
115 m[1] = m_floats[1];
116 m[2] = m_floats[2];
117 }
118*/
126 {
127 m_floats[0]=x;
128 m_floats[1]=y;
129 m_floats[2]=z;
130 m_floats[3]=w;
131 }
134 // :m_floats[0](tf2Scalar(0.)),m_floats[1](tf2Scalar(0.)),m_floats[2](tf2Scalar(0.)),m_floats[3](tf2Scalar(0.))
135 {
136 }
137
144 {
145 m_floats[0] = x, m_floats[1] = y, m_floats[2] = z, m_floats[3] = 0.0f;
146 }
147
155 {
156 m_floats[0] = x, m_floats[1] = y, m_floats[2] = z, m_floats[3] = w;
157 }
158
163 {
164 tf2SetMax(m_floats[0], other.m_floats[0]);
165 tf2SetMax(m_floats[1], other.m_floats[1]);
166 tf2SetMax(m_floats[2], other.m_floats[2]);
167 tf2SetMax(m_floats[3], other.m_floats[3]);
168 }
173 {
174 tf2SetMin(m_floats[0], other.m_floats[0]);
175 tf2SetMin(m_floats[1], other.m_floats[1]);
176 tf2SetMin(m_floats[2], other.m_floats[2]);
177 tf2SetMin(m_floats[3], other.m_floats[3]);
178 }
179
180
181
182};
183
184}
185#endif // TF2__LINEARMATH__QUADWORD_HPP
void tf2SetMax(T &a, const T &b)
Definition MinMax.hpp:50
void tf2SetMin(T &a, const T &b)
Definition MinMax.hpp:41
#define ATTRIBUTE_ALIGNED16(a)
Definition Scalar.hpp:134
#define TF2SIMD_FORCE_INLINE
Definition Scalar.hpp:129
double tf2Scalar
The tf2Scalar type abstracts floating point numbers, to easily switch between double and single float...
Definition Scalar.hpp:159
The QuadWord class is base class for Vector3 and Quaternion. Some issues under PS3 Linux with IBM 2....
Definition QuadWord.hpp:38
QuadWord()
No initialization constructor.
Definition QuadWord.hpp:133
void setValue(const tf2Scalar &x, const tf2Scalar &y, const tf2Scalar &z)
Set x,y,z and zero w.
Definition QuadWord.hpp:104
void setW(tf2Scalar w)
Set the w value.
Definition QuadWord.hpp:73
const tf2Scalar & y() const
Return the y value.
Definition QuadWord.hpp:77
const tf2Scalar & x() const
Return the x value.
Definition QuadWord.hpp:75
QuadWord(const tf2Scalar &x, const tf2Scalar &y, const tf2Scalar &z)
Three argument constructor (zeros w)
Definition QuadWord.hpp:143
void setX(tf2Scalar x)
Set the x value.
Definition QuadWord.hpp:67
void setY(tf2Scalar y)
Set the y value.
Definition QuadWord.hpp:69
const tf2Scalar & getY() const
Return the y value.
Definition QuadWord.hpp:63
const tf2Scalar & w() const
Return the w value.
Definition QuadWord.hpp:81
bool operator==(const QuadWord &other) const
Definition QuadWord.hpp:89
const tf2Scalar & z() const
Return the z value.
Definition QuadWord.hpp:79
void setValue(const tf2Scalar &x, const tf2Scalar &y, const tf2Scalar &z, const tf2Scalar &w)
Set the values.
Definition QuadWord.hpp:125
void setZ(tf2Scalar z)
Set the z value.
Definition QuadWord.hpp:71
const tf2Scalar & getX() const
Return the x value.
Definition QuadWord.hpp:61
void setMin(const QuadWord &other)
Set each element to the min of the current values and the values of another QuadWord.
Definition QuadWord.hpp:172
QuadWord(const tf2Scalar &x, const tf2Scalar &y, const tf2Scalar &z, const tf2Scalar &w)
Initializing constructor.
Definition QuadWord.hpp:154
bool operator!=(const QuadWord &other) const
Definition QuadWord.hpp:94
tf2Scalar m_floats[4]
Definition QuadWord.hpp:54
void setMax(const QuadWord &other)
Set each element to the max of the current values and the values of another QuadWord.
Definition QuadWord.hpp:162
const tf2Scalar & getZ() const
Return the z value.
Definition QuadWord.hpp:65
Definition buffer_core.hpp:58
B toMsg(const A &a)
Function that converts from one type to a ROS message type. It has to be implemented by each data typ...
#define TF2_PUBLIC
Definition visibility_control.h:57