55 #if (_MSC_VER >= 1900 || __cplusplus > 199711L || defined(__GXX_EXPERIMENTAL_CXX0X__)) && !defined(OPENVOLUMEMESH_VECTOR_LEGACY) 56 #include "Vector11T.hh" 61 #ifndef OPENVOLUMEMESH_VECTOR_HH 62 #define OPENVOLUMEMESH_VECTOR_HH 72 #if defined(__GNUC__) && defined(__SSE__) 73 #include <xmmintrin.h> 79 namespace OpenVolumeMesh {
96 template<
typename Scalar,
int N>
class VectorDataT {
102 #if defined(__GNUC__) && defined(__SSE__) 105 template<>
class VectorDataT<float, 4> {
122 #define TEMPLATE_HEADER template <typename Scalar, int N> 123 #define CLASSNAME VectorT 124 #define DERIVED VectorDataT<Scalar,N> 125 #define unroll(expr) for (int i=0; i<N; ++i) expr(i) 132 #include "VectorT_inc.hh" 135 #undef TEMPLATE_HEADER 145 #define TEMPLATE_HEADER template <typename Scalar> 146 #define CLASSNAME VectorT<Scalar,DIM> 147 #define DERIVED VectorDataT<Scalar,DIM> 151 #define unroll(expr) expr(0) expr(1) 152 #define unroll_comb(expr, op) expr(0) op expr(1) 153 #define unroll_csv(expr) expr(0), expr(1) 154 #include "VectorT_inc.hh" 161 #define unroll(expr) expr(0) expr(1) expr(2) 162 #define unroll_comb(expr, op) expr(0) op expr(1) op expr(2) 163 #define unroll_csv(expr) expr(0), expr(1), expr(2) 164 #include "VectorT_inc.hh" 171 #define unroll(expr) expr(0) expr(1) expr(2) expr(3) 172 #define unroll_comb(expr, op) expr(0) op expr(1) op expr(2) op expr(3) 173 #define unroll_csv(expr) expr(0), expr(1), expr(2), expr(3) 174 #include "VectorT_inc.hh" 181 #define unroll(expr) expr(0) expr(1) expr(2) expr(3) expr(4) 182 #define unroll_comb(expr, op) expr(0) op expr(1) op expr(2) op expr(3) op expr(4) 183 #define unroll_csv(expr) expr(0), expr(1), expr(2), expr(3), expr(4) 184 #include "VectorT_inc.hh" 191 #define unroll(expr) expr(0) expr(1) expr(2) expr(3) expr(4) expr(5) 192 #define unroll_comb(expr, op) expr(0) op expr(1) op expr(2) op expr(3) op expr(4) op expr(5) 193 #define unroll_csv(expr) expr(0), expr(1), expr(2), expr(3), expr(4), expr(5) 194 #include "VectorT_inc.hh" 201 #undef TEMPLATE_HEADER 210 inline VectorT<float,3>
214 VectorT<float,3>(values_[1]*_rhs.values_[2]-values_[2]*_rhs.values_[1],
215 values_[2]*_rhs.values_[0]-values_[0]*_rhs.values_[2],
216 values_[0]*_rhs.values_[1]-values_[1]*_rhs.values_[0]);
222 inline VectorT<double,3>
226 VectorT<double,3>(values_[1]*_rhs.values_[2]-values_[2]*_rhs.values_[1],
227 values_[2]*_rhs.values_[0]-values_[0]*_rhs.values_[2],
228 values_[0]*_rhs.values_[1]-values_[1]*_rhs.values_[0]);
238 template<
typename Scalar1,
typename Scalar2,
int N>
239 inline VectorT<Scalar1,N> operator*(Scalar2 _s,
const VectorT<Scalar1,N>& _v) {
246 template<
typename Scalar,
int N>
248 dot(
const VectorT<Scalar,N>& _v1,
const VectorT<Scalar,N>& _v2) {
255 template<
typename Scalar,
int N>
256 inline VectorT<Scalar,N>
257 cross(
const VectorT<Scalar,N>& _v1,
const VectorT<Scalar,N>& _v2) {
267 typedef VectorT<signed char,1> Vec1c;
269 typedef VectorT<unsigned char,1> Vec1uc;
271 typedef VectorT<signed short int,1> Vec1s;
273 typedef VectorT<unsigned short int,1> Vec1us;
275 typedef VectorT<signed int,1> Vec1i;
277 typedef VectorT<unsigned int,1> Vec1ui;
279 typedef VectorT<float,1> Vec1f;
281 typedef VectorT<double,1> Vec1d;
284 typedef VectorT<signed char,2> Vec2c;
286 typedef VectorT<unsigned char,2> Vec2uc;
288 typedef VectorT<signed short int,2> Vec2s;
290 typedef VectorT<unsigned short int,2> Vec2us;
292 typedef VectorT<signed int,2> Vec2i;
294 typedef VectorT<unsigned int,2> Vec2ui;
296 typedef VectorT<float,2> Vec2f;
298 typedef VectorT<double,2> Vec2d;
301 typedef VectorT<signed char,3> Vec3c;
303 typedef VectorT<unsigned char,3> Vec3uc;
305 typedef VectorT<signed short int,3> Vec3s;
307 typedef VectorT<unsigned short int,3> Vec3us;
309 typedef VectorT<signed int,3> Vec3i;
311 typedef VectorT<unsigned int,3> Vec3ui;
313 typedef VectorT<float,3> Vec3f;
315 typedef VectorT<double,3> Vec3d;
317 typedef VectorT<bool,3> Vec3b;
320 typedef VectorT<signed char,4> Vec4c;
322 typedef VectorT<unsigned char,4> Vec4uc;
324 typedef VectorT<signed short int,4> Vec4s;
326 typedef VectorT<unsigned short int,4> Vec4us;
328 typedef VectorT<signed int,4> Vec4i;
330 typedef VectorT<unsigned int,4> Vec4ui;
332 typedef VectorT<float,4> Vec4f;
334 typedef VectorT<double,4> Vec4d;
337 typedef VectorT<signed char, 5> Vec5c;
339 typedef VectorT<unsigned char, 5> Vec5uc;
341 typedef VectorT<signed short int, 5> Vec5s;
343 typedef VectorT<unsigned short int, 5> Vec5us;
345 typedef VectorT<signed int, 5> Vec5i;
347 typedef VectorT<unsigned int, 5> Vec5ui;
349 typedef VectorT<float, 5> Vec5f;
351 typedef VectorT<double, 5> Vec5d;
354 typedef VectorT<signed char,6> Vec6c;
356 typedef VectorT<unsigned char,6> Vec6uc;
358 typedef VectorT<signed short int,6> Vec6s;
360 typedef VectorT<unsigned short int,6> Vec6us;
362 typedef VectorT<signed int,6> Vec6i;
364 typedef VectorT<unsigned int,6> Vec6ui;
366 typedef VectorT<float,6> Vec6f;
368 typedef VectorT<double,6> Vec6d;
374 const std::string typeName();
376 template <>
const std::string typeName<Geometry::Vec2f>();
377 template <>
const std::string typeName<Geometry::Vec2d>();
378 template <>
const std::string typeName<Geometry::Vec2i>();
379 template <>
const std::string typeName<Geometry::Vec2ui>();
381 template <>
const std::string typeName<Geometry::Vec3f>();
382 template <>
const std::string typeName<Geometry::Vec3d>();
383 template <>
const std::string typeName<Geometry::Vec3i>();
384 template <>
const std::string typeName<Geometry::Vec3ui>();
386 template <>
const std::string typeName<Geometry::Vec4f>();
387 template <>
const std::string typeName<Geometry::Vec4d>();
388 template <>
const std::string typeName<Geometry::Vec4i>();
389 template <>
const std::string typeName<Geometry::Vec4ui>();
393 #endif // OPENVOLUMEMESH_VECTOR_HH defined auto operator%(const VectorT< OtherScalar, DIM > &_rhs) const -> typename std::enable_if< DIM==3, VectorT< decltype(this->values_[0] *_rhs[0] - this->values_[0] *_rhs[0]), DIM >>::type
Definition: Vector11T.hh:362