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; }
126 template<
typename TVectorValueType >
128 NVectorDimension > & r):BaseArray(r) {}
133 template<
typename Tt >
147 template<
typename Tt >
150 for (
unsigned int i = 0; i < NVectorDimension; i++ )
152 ( *this )[i] =
static_cast< ValueType
>( ( *this )[i] * value );
159 template<
typename Tt >
162 for (
unsigned int i = 0; i < NVectorDimension; i++ )
164 ( *this )[i] =
static_cast< ValueType
>( ( *this )[i] / value );
202 for (
unsigned int i = 0; i < NVectorDimension; i++ )
204 result[i] =
static_cast< ValueType
>( ( *this )[i] * val );
211 template<
typename Tt >
216 for (
unsigned int i = 0; i < NVectorDimension; i++ )
218 result[i] =
static_cast< ValueType
>( ( *this )[i] / val );
237 template<
typename TCoordRepB >
240 for (
unsigned int i = 0; i < NVectorDimension; i++ )
242 ( *this )[i] =
static_cast< T
>( pa[i] );
250 template<
typename T,
unsigned int NVectorDimension >
255 return v.operator*(scalar);
260 template<
typename T,
unsigned int NVectorDimension >
265 return covariant.operator*( contravariant );
291 #ifndef ITK_MANUAL_INSTANTIATION 292 #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
FixedArray< T, NVectorDimension > BaseArray
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes...
NumericTraits< ValueType >::RealType RealValueType
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)
RealValueType Normalize()
A templated class holding a n-Dimensional vector.
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)
RealValueType GetSquaredNorm() const
static unsigned int GetNumberOfComponents()
RealValueType GetNorm() const
A templated class holding a n-Dimensional covariant vector.
vnl_vector_ref< T > GetVnlVector()
const Self & operator*=(const Tt &value)
static unsigned int GetCovariantVectorDimension()