38 template<
typename T,
int Size>
68 for (
int i = 0; i < Size; ++i)
70 result += this->
Data[i] * this->
Data[i];
80 return sqrt(static_cast<double>(this->
SquaredNorm()));
88 const double norm(this->
Norm());
89 const double inv(1.0 / norm);
90 for (
int i = 0; i < Size; ++i)
92 this->
Data[i] =
static_cast<T
>(this->
Data[i] * inv);
114 for (
int i = 0; i < Size; ++i)
116 result += this->
Data[i] * other[i];
124 template<
typename TR>
128 for (
int i = 0; i < Size; ++i)
130 result[i] =
static_cast<TR
>(this->
Data[i]);
163 void Set(
const T& x,
const T& y)
212 void Set(
const T& x,
const T& y,
const T& z)
253 #define vtkVectorNormalized(vectorType, type, size) \
254 vectorType Normalized() const \
256 return vectorType(vtkVector<type, size>::Normalized().GetData()); \
260 #define vtkVectorDerivedMacro(vectorType, type, size) \
261 vtkVectorNormalized(vectorType, type, size) \
262 explicit vectorType(type s) : Superclass(s) {} \
263 explicit vectorType(const type *i) : Superclass(i) {} \
264 explicit vectorType(const vtkTuple<type, size> &o) : Superclass(o.GetData()) {} \
265 vectorType(const vtkVector<type, size> &o) : Superclass(o.GetData()) {} \
297 #define vtkVector3Cross(vectorType, type) \
298 vectorType Cross(const vectorType& other) const \
300 return vectorType(vtkVector3<type>::Cross(other).GetData()); \
333 #endif // vtkVector_h
#define vtkVector3Cross(vectorType, type)
vtkVector2(const T &scalar)
#define vtkVectorDerivedMacro(vectorType, type, size)
vtkVector3< float > Superclass
templated base type for storage of vectors.
vtkVector3< int > Superclass
vtkVector2i(int x, int y)
vtkVector2(const T *init)
void Set(const T &x, const T &y)
vtkVector3d(double x, double y, double z)
vtkVector2< int > Superclass
vtkVector3(const T &scalar)
vtkVector3< double > Superclass
T Dot(const vtkVector< T, Size > &other) const
vtkVector2f(float x, float y)
vtkVector2< double > Superclass
vtkVector(const T &scalar)
vtkVector2d(double x, double y)
templated base type for containers of constant size.
vtkVector3i(int x, int y, int z)
vtkVector2(const T &x, const T &y)
void Set(const T &x, const T &y, const T &z)
vtkVector2< float > Superclass
vtkVector< T, Size > Normalized() const
vtkVector3< T > Cross(const vtkVector3< T > &other) const
vtkVectorDerivedMacro(vtkVector3i, int, 3) vtkVector3Cross(vtkVector3i
vtkVector< TR, Size > Cast() const
vtkVector3(const T &x, const T &y, const T &z)
vtkVector3(const T *init)
vtkVector3f(float x, float y, float z)