/* * Copyright (C) 2009 * Robert Bosch LLC * Research and Technology Center North America * Palo Alto, California * * All rights reserved. * *------------------------------------------------------------------------------ * project ....: Autonomous Technologies * file .......: rtcVec4.h * authors ....: Benjamin Pitzer * organization: Robert Bosch LLC * creation ...: 08/16/2006 * modified ...: $Date: 2009-01-21 18:19:16 -0800 (Wed, 21 Jan 2009) $ * changed by .: $Author: benjaminpitzer $ * revision ...: $Revision: 14 $ */ #ifndef RTC_VEC4_H #define RTC_VEC4_H //== INCLUDES ================================================================== #include "rtcMath.h" #include "rtcVec.h" //== NAMESPACES ================================================================ namespace rtc { // Forward declarations template class Vec; // M-d vector template class Vec4; // 4d Vector /** * A 4-D vector. */ template class Vec4: public Vec { public: // inherit member data and functions of parent using Vec::x; using Vec::set; // Constructors Vec4(); Vec4(const T* d); Vec4(const T a); Vec4(const T x0, const T x1, const T x2, const T x3); Vec4(const Vec& v); // Cast Operation template Vec4(const Vec& v); // Mutators void set(const T x0, const T x1, const T x2, const T x3); }; // Declare a few common typdefs typedef Vec4 Vec4b; typedef Vec4 Vec4c; typedef Vec4 Vec4uc; typedef Vec4 Vec4s; typedef Vec4 Vec4us; typedef Vec4 Vec4i; typedef Vec4 Vec4ui; typedef Vec4 Vec4f; typedef Vec4 Vec4d; //============================================================================== // Vec4 //============================================================================== // Constructors /** Ctor that doesn't initialize. */ template inline Vec4::Vec4() {} /** Ctor that intalizes from array. */ template inline Vec4::Vec4(const T* d) : Vec(d) {} /** Ctor that intalizes all elements from a scalar. */ template inline Vec4::Vec4(const T a) : Vec(a) {} /** Ctor that initializes vector with given values. */ template inline Vec4::Vec4(const T x0, const T x1, const T x2, const T x3) { set(x0,x1,x2,x3); } /** Ctor that initializes an Vec4 with an Vec. */ template inline Vec4::Vec4(const Vec& v) : Vec(v) {} // Casting Operation /** Casting Ctor that initializes an Vec4 with a Vec. */ template template inline Vec4::Vec4(const Vec& v) : Vec(v) {} // Mutators /** Set vector. */ template inline void Vec4::set(const T x0, const T x1, const T x2, const T x3) { x[0] = x0; x[1] = x1; x[2] = x2; x[3] = x3; } //============================================================================== } // NAMESPACE puma //============================================================================== #endif // RTC_VEC4_H defined //==============================================================================