Eigen::UniformScaling< Scalar_ > Class Template Reference

Represents a generic uniform scaling transformation. More...

Public Types

typedef Scalar_ Scalar
 

Public Member Functions

template<typename NewScalarType >
UniformScaling< NewScalarType > cast () const
 
Scalarfactor ()
 
const Scalarfactor () const
 
UniformScaling inverse () const
 
bool isApprox (const UniformScaling &other, const typename NumTraits< Scalar >::Real &prec=NumTraits< Scalar >::dummy_precision()) const
 
template<typename Derived >
Eigen::internal::plain_matrix_type< Derived >::type operator* (const MatrixBase< Derived > &other) const
 
template<typename Derived , int Dim>
Matrix< Scalar, Dim, Dim > operator* (const RotationBase< Derived, Dim > &r) const
 
template<int Dim, int Mode, int Options>
internal::uniformscaling_times_affine_returntype< Scalar, Dim, Mode >::type operator* (const Transform< Scalar, Dim, Mode, Options > &t) const
 
template<int Dim>
Transform< Scalar, Dim, Affineoperator* (const Translation< Scalar, Dim > &t) const
 
UniformScaling operator* (const UniformScaling &other) const
 
 UniformScaling ()
 
 UniformScaling (const Scalar &s)
 
template<typename OtherScalarType >
 UniformScaling (const UniformScaling< OtherScalarType > &other)
 

Protected Attributes

Scalar m_factor
 

Related Functions

(Note that these are not member functions.)

template<typename Derived , typename Scalar >
 operator* (const MatrixBase< Derived > &matrix, const UniformScaling< Scalar > &s)
 

Detailed Description

template<typename Scalar_>
class Eigen::UniformScaling< Scalar_ >

Represents a generic uniform scaling transformation.

This is defined in the Geometry module.

Template Parameters
Scalar_the 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 51 of file Scaling.h.

Member Typedef Documentation

◆ Scalar

template<typename Scalar_ >
typedef Scalar_ Eigen::UniformScaling< Scalar_ >::Scalar

the scalar type of the coefficients

Definition at line 55 of file Scaling.h.

Constructor & Destructor Documentation

◆ UniformScaling() [1/3]

template<typename Scalar_ >
Eigen::UniformScaling< Scalar_ >::UniformScaling ( )
inline

Default constructor without initialization.

Definition at line 64 of file Scaling.h.

64 {}

◆ UniformScaling() [2/3]

template<typename Scalar_ >
Eigen::UniformScaling< Scalar_ >::UniformScaling ( const Scalar s)
inlineexplicit

Constructs and initialize a uniform scaling transformation

Definition at line 66 of file Scaling.h.

66 : m_factor(s) {}

◆ UniformScaling() [3/3]

template<typename Scalar_ >
template<typename OtherScalarType >
Eigen::UniformScaling< Scalar_ >::UniformScaling ( const UniformScaling< OtherScalarType > &  other)
inlineexplicit

Copy constructor with scalar type conversion

Definition at line 115 of file Scaling.h.

116  { m_factor = Scalar(other.factor()); }

Member Function Documentation

◆ cast()

template<typename Scalar_ >
template<typename NewScalarType >
UniformScaling<NewScalarType> Eigen::UniformScaling< Scalar_ >::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 110 of file Scaling.h.

111  { return UniformScaling<NewScalarType>(NewScalarType(m_factor)); }

◆ factor() [1/2]

template<typename Scalar_ >
Scalar& Eigen::UniformScaling< Scalar_ >::factor ( )
inline

Definition at line 69 of file Scaling.h.

69 { return m_factor; }

◆ factor() [2/2]

template<typename Scalar_ >
const Scalar& Eigen::UniformScaling< Scalar_ >::factor ( ) const
inline

Definition at line 68 of file Scaling.h.

68 { return m_factor; }

◆ inverse()

template<typename Scalar_ >
UniformScaling Eigen::UniformScaling< Scalar_ >::inverse ( ) const
inline
Returns
the inverse scaling

Definition at line 101 of file Scaling.h.

102  { return UniformScaling(Scalar(1)/m_factor); }

◆ isApprox()

template<typename Scalar_ >
bool Eigen::UniformScaling< Scalar_ >::isApprox ( const UniformScaling< Scalar_ > &  other,
const typename NumTraits< Scalar >::Real &  prec = NumTraits<Scalar>::dummy_precision() 
) const
inline
Returns
true if *this is approximately equal to other, within the precision determined by prec.
See also
MatrixBase::isApprox()

Definition at line 122 of file Scaling.h.

123  { return internal::isApprox(m_factor, other.factor(), prec); }
bool isApprox(const Scalar &x, const Scalar &y, const typename NumTraits< Scalar >::Real &precision=NumTraits< Scalar >::dummy_precision())

◆ operator*() [1/5]

template<typename Scalar_ >
template<typename Derived >
Eigen::internal::plain_matrix_type<Derived>::type Eigen::UniformScaling< Scalar_ >::operator* ( const MatrixBase< Derived > &  other) const
inline

Concatenates a uniform scaling and a linear transformation matrix

Definition at line 93 of file Scaling.h.

94  { return other * m_factor; }

◆ operator*() [2/5]

template<typename Scalar_ >
template<typename Derived , int Dim>
Matrix<Scalar,Dim,Dim> Eigen::UniformScaling< Scalar_ >::operator* ( const RotationBase< Derived, Dim > &  r) const
inline

Definition at line 97 of file Scaling.h.

98  { return r.toRotationMatrix() * m_factor; }

◆ operator*() [3/5]

template<typename Scalar_ >
template<int Dim, int Mode, int Options>
internal::uniformscaling_times_affine_returntype<Scalar,Dim,Mode>::type Eigen::UniformScaling< Scalar_ >::operator* ( const Transform< Scalar, Dim, Mode, Options > &  t) const
inline

Concatenates a uniform scaling and an affine transformation

Definition at line 83 of file Scaling.h.

84  {
85  typename internal::uniformscaling_times_affine_returntype<Scalar,Dim,Mode>::type res = t;
86  res.prescale(factor());
87  return res;
88  }
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
const Scalar & factor() const
Definition: Scaling.h:68

◆ operator*() [4/5]

template<typename Scalar >
template<int Dim>
Transform< Scalar, Dim, Affine > Eigen::UniformScaling< Scalar >::operator* ( const Translation< Scalar, Dim > &  t) const
inline

Concatenates a uniform scaling and a translation

Definition at line 183 of file Scaling.h.

184 {
185  Transform<Scalar,Dim,Affine> res;
186  res.matrix().setZero();
187  res.linear().diagonal().fill(factor());
188  res.translation() = factor() * t.vector();
189  res(Dim,Dim) = Scalar(1);
190  return res;
191 }

◆ operator*() [5/5]

template<typename Scalar_ >
UniformScaling Eigen::UniformScaling< Scalar_ >::operator* ( const UniformScaling< Scalar_ > &  other) const
inline

Concatenates two uniform scaling

Definition at line 72 of file Scaling.h.

73  { return UniformScaling(m_factor * other.factor()); }

Friends And Related Function Documentation

◆ operator*()

template<typename Derived , typename Scalar >
operator* ( const MatrixBase< Derived > &  matrix,
const UniformScaling< Scalar > &  s 
)
related

Concatenates a linear transformation matrix and a uniform scaling

Definition at line 137 of file Scaling.h.

138 { return matrix.derived() * s.factor(); }

Member Data Documentation

◆ m_factor

template<typename Scalar_ >
Scalar Eigen::UniformScaling< Scalar_ >::m_factor
protected

Definition at line 59 of file Scaling.h.


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