18 #ifndef __itkCovariantVector_h
19 #define __itkCovariantVector_h
21 #include "vnl/vnl_vector_ref.h"
66 template<
class T,
unsigned int NVectorDimension = 3 >
83 itkStaticConstMacro(Dimension,
unsigned int, NVectorDimension);
92 static unsigned int GetCovariantVectorDimension()
93 {
return NVectorDimension; }
99 vnl_vector_ref< T > GetVnlVector(
void);
110 itkLegacyMacro(vnl_vector_ref< T > Get_vnl_vector(
void));
122 template<
class TVectorValueType >
132 BaseArray::operator=(v);
144 inline const Self & operator*=(
const Tt & value)
146 for (
unsigned int i = 0; i < NVectorDimension; i++ )
148 ( *this )[i] =
static_cast< ValueType >( ( *this )[i] * value );
156 const Self & operator/=(
const Tt & value)
158 for (
unsigned int i = 0; i < NVectorDimension; i++ )
160 ( *this )[i] =
static_cast< ValueType >( ( *this )[i] / value );
167 const Self & operator+=(
const Self & vec);
170 const Self & operator-=(
const Self & vec);
198 for (
unsigned int i = 0; i < NVectorDimension; i++ )
200 result[i] =
static_cast< ValueType >( ( *this )[i] * val );
208 inline Self operator/(
const Tt & val)
const
212 for (
unsigned int i = 0; i < NVectorDimension; i++ )
214 result[i] =
static_cast< ValueType >( ( *this )[i] / val );
220 RealValueType GetNorm(
void)
const;
226 void Normalize(
void);
229 RealValueType GetSquaredNorm(
void)
const;
233 template<
typename TCoordRepB >
236 for (
unsigned int i = 0; i < NVectorDimension; i++ )
238 ( *this )[i] =
static_cast< T
>( pa[i] );
246 template<
class T,
unsigned int NVectorDimension >
248 CovariantVector< T, NVectorDimension >
256 template<
class T,
unsigned int NVectorDimension >
261 return covariant.operator*( contravariant );
264 ITKCommon_EXPORT
void CrossProduct(CovariantVector< double, 3 > &,
265 const Vector< double, 3 > &,
266 const Vector< double, 3 > &);
268 ITKCommon_EXPORT
void CrossProduct(CovariantVector< float, 3 > &,
269 const Vector< float, 3 > &,
270 const Vector< float, 3 > &);
272 ITKCommon_EXPORT
void CrossProduct(CovariantVector< int, 3 >,
273 const Vector< int, 3 > &,
274 const Vector< int, 3 > &);
287 #ifndef ITK_MANUAL_INSTANTIATION
288 #include "itkCovariantVector.hxx"