18 #ifndef __itkCovariantVector_h
19 #define __itkCovariantVector_h
23 #include "vnl/vnl_vector_ref.h"
66 template<
typename T,
unsigned int NVectorDimension = 3 >
83 itkStaticConstMacro(
Dimension,
unsigned int, NVectorDimension);
93 {
return NVectorDimension; }
122 template<
typename TVectorValueType >
129 template<
typename Tt >
143 template<
typename Tt >
146 for (
unsigned int i = 0; i < NVectorDimension; i++ )
148 ( *this )[i] =
static_cast< ValueType >( ( *this )[i] * value );
155 template<
typename Tt >
158 for (
unsigned int i = 0; i < NVectorDimension; i++ )
160 ( *this )[i] =
static_cast< ValueType >( ( *this )[i] / value );
198 for (
unsigned int i = 0; i < NVectorDimension; i++ )
200 result[i] =
static_cast< ValueType >( ( *this )[i] * val );
207 template<
typename Tt >
212 for (
unsigned int i = 0; i < NVectorDimension; i++ )
214 result[i] =
static_cast< ValueType >( ( *this )[i] / val );
233 template<
typename TCoordRepB >
236 for (
unsigned int i = 0; i < NVectorDimension; i++ )
238 ( *this )[i] =
static_cast< T
>( pa[i] );
246 template<
typename T,
unsigned int NVectorDimension >
248 CovariantVector< T, NVectorDimension >
251 return v.operator*(scalar);
256 template<
typename T,
unsigned int NVectorDimension >
261 return covariant.operator*( contravariant );
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"
itkLegacyMacro(void Set_vnl_vector(const vnl_vector< T > &))
void CastFrom(const CovariantVector< TCoordRepB, NVectorDimension > &pa)
void SetVnlVector(const vnl_vector< T > &)
Self & operator=(const Tt &v)
const Self & operator/=(const Tt &value)
static const unsigned int Dimension
Self operator*(const ValueType &val) const
CovariantVector< T, NVectorDimension > operator*(const T &scalar, const CovariantVector< T, NVectorDimension > &v)
FixedArray< T, NVectorDimension > BaseArray
NumericTraits< ValueType >::RealType RealValueType
vnl_vector_ref< T > GetVnlVector(void)
CovariantVector(const ValueType r[Dimension])
Simulate a standard C array with copy semnatics.
ValueType operator*(const Self &vec) const
CovariantVector(const CovariantVector< TVectorValueType, NVectorDimension > &r)
A templated class holding a n-Dimensional vector.
RealValueType GetSquaredNorm(void) const
RealValueType GetNorm(void) const
ITKCommon_EXPORT void CrossProduct(CovariantVector< double, 3 > &, const Vector< double, 3 > &, const Vector< double, 3 > &)
const Self & operator-=(const Self &vec)
Self operator+(const Self &vec) const
FixedArray & operator=(const FixedArray< TFixedArrayValueType, VLength > &r)
Self operator/(const Tt &val) const
FixedArray< T, NVectorDimension > Superclass
const Self & operator+=(const Self &vec)
static unsigned int GetNumberOfComponents()
A templated class holding a n-Dimensional covariant vector.
const Self & operator*=(const Tt &value)
static unsigned int GetCovariantVectorDimension()