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 >
254 ITKCommon_EXPORT
void CrossProduct(CovariantVector< double, 3 > &,
255 const Vector< double, 3 > &,
256 const Vector< double, 3 > &);
258 ITKCommon_EXPORT
void CrossProduct(CovariantVector< float, 3 > &,
259 const Vector< float, 3 > &,
260 const Vector< float, 3 > &);
262 ITKCommon_EXPORT
void CrossProduct(CovariantVector< int, 3 >,
263 const Vector< int, 3 > &,
264 const Vector< int, 3 > &);
268 #define ITK_TEMPLATE_CovariantVector(_, EXPORT, TypeX, TypeY) \
271 _( 2 ( class EXPORT CovariantVector< ITK_TEMPLATE_2 TypeX > ) ) \
272 namespace Templates \
274 typedef CovariantVector< ITK_TEMPLATE_2 TypeX > \
275 CovariantVector##TypeY; \
279 #if ITK_TEMPLATE_EXPLICIT
280 #include "Templates/itkCovariantVector+-.h"
294 #include "itkCovariantVector.hxx"