Shapeworks Studio  2.1
Shape analysis software suite
List of all members | Public Types | Public Member Functions | Protected Attributes | Friends
Eigen::Scaling< _Scalar, _Dim > Class Template Reference

Represents a possibly non uniform scaling transformation. More...

#include <Scaling.h>

+ Collaboration diagram for Eigen::Scaling< _Scalar, _Dim >:

Public Types

enum  { Dim = _Dim }
 
typedef _Scalar Scalar
 
typedef Matrix< Scalar, Dim, 1 > VectorType
 
typedef Matrix< Scalar, Dim, Dim > LinearMatrixType
 
typedef Translation< Scalar, Dim > TranslationType
 
typedef Transform< Scalar, Dim > TransformType
 

Public Member Functions

 Scaling ()
 
 Scaling (const Scalar &s)
 
 Scaling (const Scalar &sx, const Scalar &sy)
 
 Scaling (const Scalar &sx, const Scalar &sy, const Scalar &sz)
 
 Scaling (const VectorType &coeffs)
 
const VectorTypecoeffs () const
 
VectorTypecoeffs ()
 
Scaling operator* (const Scaling &other) const
 
TransformType operator* (const TranslationType &t) const
 
TransformType operator* (const TransformType &t) const
 
LinearMatrixType operator* (const LinearMatrixType &other) const
 
template<typename Derived >
LinearMatrixType operator* (const RotationBase< Derived, Dim > &r) const
 
VectorType operator* (const VectorType &other) const
 
Scaling inverse () const
 
Scalingoperator= (const Scaling &other)
 
template<typename NewScalarType >
internal::cast_return_type< Scaling, Scaling< NewScalarType, Dim > >::type cast () const
 
template<typename OtherScalarType >
 Scaling (const Scaling< OtherScalarType, Dim > &other)
 
bool isApprox (const Scaling &other, typename NumTraits< Scalar >::Real prec=precision< Scalar >()) const
 

Protected Attributes

VectorType m_coeffs
 

Friends

LinearMatrixType operator* (const LinearMatrixType &other, const Scaling &s)
 

Detailed Description

template<typename _Scalar, int _Dim>
class Eigen::Scaling< _Scalar, _Dim >

Represents a possibly non uniform scaling transformation.

Represents a generic uniform scaling transformation.

Parameters
_Scalarthe scalar type, i.e., the type of the coefficients.
_Dimthe dimension of the space, can be a compile time value or Dynamic
Note
This class is not aimed to be used to store a scaling transformation, but rather to make easier the constructions and updates of Transform objects.
See also
class Translation, class Transform
Parameters
_Scalarthe scalar type, i.e., the type of the coefficients.

This class represent a uniform scaling transformation. It is the return type of Scaling(Scalar), and most of the time this is the only way it is used. In particular, this class is not aimed to be used to store a scaling transformation, but rather to make easier the constructions and updates of Transform objects.

To represent an axis aligned scaling, use the DiagonalMatrix class.

See also
Scaling(), class DiagonalMatrix, MatrixBase::asDiagonal(), class Translation, class Transform

Definition at line 29 of file Scaling.h.

Member Typedef Documentation

template<typename _Scalar, int _Dim>
typedef Matrix<Scalar,Dim,Dim> Eigen::Scaling< _Scalar, _Dim >::LinearMatrixType

corresponding linear transformation matrix type

Definition at line 40 of file Scaling.h.

template<typename _Scalar, int _Dim>
typedef _Scalar Eigen::Scaling< _Scalar, _Dim >::Scalar

the scalar type of the coefficients

Definition at line 36 of file Scaling.h.

template<typename _Scalar, int _Dim>
typedef Transform<Scalar,Dim> Eigen::Scaling< _Scalar, _Dim >::TransformType

corresponding affine transformation type

Definition at line 44 of file Scaling.h.

template<typename _Scalar, int _Dim>
typedef Translation<Scalar,Dim> Eigen::Scaling< _Scalar, _Dim >::TranslationType

corresponding translation type

Definition at line 42 of file Scaling.h.

template<typename _Scalar, int _Dim>
typedef Matrix<Scalar,Dim,1> Eigen::Scaling< _Scalar, _Dim >::VectorType

corresponding vector type

Definition at line 38 of file Scaling.h.

Member Enumeration Documentation

template<typename _Scalar, int _Dim>
anonymous enum

dimension of the space

Definition at line 34 of file Scaling.h.

34 { Dim = _Dim };

Constructor & Destructor Documentation

template<typename _Scalar, int _Dim>
Eigen::Scaling< _Scalar, _Dim >::Scaling ( )
inline

Default constructor without initialization.

Definition at line 53 of file Scaling.h.

53 {}
template<typename _Scalar, int _Dim>
Eigen::Scaling< _Scalar, _Dim >::Scaling ( const Scalar s)
inlineexplicit

Constructs and initialize a uniform scaling transformation

Definition at line 55 of file Scaling.h.

55 { m_coeffs.setConstant(s); }
Derived & setConstant(Index size, const Scalar &value)
template<typename _Scalar, int _Dim>
Eigen::Scaling< _Scalar, _Dim >::Scaling ( const Scalar sx,
const Scalar sy 
)
inline

2D only

Definition at line 57 of file Scaling.h.

58  {
59  ei_assert(Dim==2);
60  m_coeffs.x() = sx;
61  m_coeffs.y() = sy;
62  }
template<typename _Scalar, int _Dim>
Eigen::Scaling< _Scalar, _Dim >::Scaling ( const Scalar sx,
const Scalar sy,
const Scalar sz 
)
inline

3D only

Definition at line 64 of file Scaling.h.

65  {
66  ei_assert(Dim==3);
67  m_coeffs.x() = sx;
68  m_coeffs.y() = sy;
69  m_coeffs.z() = sz;
70  }
template<typename _Scalar, int _Dim>
Eigen::Scaling< _Scalar, _Dim >::Scaling ( const VectorType coeffs)
inlineexplicit

Constructs and initialize the scaling transformation from a vector of scaling coefficients

Definition at line 72 of file Scaling.h.

72 : m_coeffs(coeffs) {}
template<typename _Scalar, int _Dim>
template<typename OtherScalarType >
Eigen::Scaling< _Scalar, _Dim >::Scaling ( const Scaling< OtherScalarType, Dim > &  other)
inlineexplicit

Copy constructor with scalar type conversion

Definition at line 126 of file Scaling.h.

127  { m_coeffs = other.coeffs().template cast<Scalar>(); }

Member Function Documentation

template<typename _Scalar, int _Dim>
template<typename NewScalarType >
internal::cast_return_type<Scaling,Scaling<NewScalarType,Dim> >::type Eigen::Scaling< _Scalar, _Dim >::cast ( ) const
inline
Returns
*this with scalar type casted to NewScalarType

Note that if NewScalarType is equal to the current scalar type of *this then this function smartly returns a const reference to *this.

Definition at line 121 of file Scaling.h.

122  { return typename internal::cast_return_type<Scaling,Scaling<NewScalarType,Dim> >::type(*this); }
template<typename _Scalar, int _Dim>
Scaling Eigen::Scaling< _Scalar, _Dim >::inverse ( void  ) const
inline
Returns
the inverse scaling

Definition at line 106 of file Scaling.h.

107  { return Scaling(coeffs().cwise().inverse()); }
Scaling inverse() const
Definition: Scaling.h:106
template<typename _Scalar, int _Dim>
bool Eigen::Scaling< _Scalar, _Dim >::isApprox ( const Scaling< _Scalar, _Dim > &  other,
typename NumTraits< Scalar >::Real  prec = precision<Scalar>() 
) const
inline
Returns
true if *this is approximately equal to other, within the precision determined by prec.
See also
MatrixBase::isApprox()

Definition at line 133 of file Scaling.h.

134  { return m_coeffs.isApprox(other.m_coeffs, prec); }
template<typename _Scalar, int _Dim>
Scaling Eigen::Scaling< _Scalar, _Dim >::operator* ( const Scaling< _Scalar, _Dim > &  other) const
inline

Concatenates two scaling

Definition at line 78 of file Scaling.h.

79  { return Scaling(coeffs().cwise() * other.coeffs()); }
template<typename Scalar , int Dim>
Scaling< Scalar, Dim >::TransformType Eigen::Scaling< Scalar, Dim >::operator* ( const TranslationType t) const
inline

Concatenates a scaling and a translation

Definition at line 148 of file Scaling.h.

149 {
150  TransformType res;
151  res.matrix().setZero();
152  res.linear().diagonal() = coeffs();
153  res.translation() = m_coeffs.cwise() * t.vector();
154  res(Dim,Dim) = Scalar(1);
155  return res;
156 }
_Scalar Scalar
Definition: Scaling.h:36
Transform< Scalar, Dim > TransformType
Definition: Scaling.h:44
template<typename Scalar , int Dim>
Scaling< Scalar, Dim >::TransformType Eigen::Scaling< Scalar, Dim >::operator* ( const TransformType t) const
inline

Concatenates a scaling and an affine transformation

Definition at line 160 of file Scaling.h.

161 {
162  TransformType res = t;
163  res.prescale(m_coeffs);
164  return res;
165 }
Transform< Scalar, Dim > TransformType
Definition: Scaling.h:44
template<typename _Scalar, int _Dim>
LinearMatrixType Eigen::Scaling< _Scalar, _Dim >::operator* ( const LinearMatrixType other) const
inline

Concatenates a scaling and a linear transformation matrix

Definition at line 89 of file Scaling.h.

90  { return coeffs().asDiagonal() * other; }
template<typename _Scalar, int _Dim>
VectorType Eigen::Scaling< _Scalar, _Dim >::operator* ( const VectorType other) const
inline

Applies scaling to vector

Definition at line 102 of file Scaling.h.

103  { return coeffs().asDiagonal() * other; }

Friends And Related Function Documentation

template<typename _Scalar, int _Dim>
LinearMatrixType operator* ( const LinearMatrixType other,
const Scaling< _Scalar, _Dim > &  s 
)
friend

Concatenates a linear transformation matrix and a scaling

Definition at line 94 of file Scaling.h.

95  { return other * s.coeffs().asDiagonal(); }

The documentation for this class was generated from the following file: