DGtal  1.5.beta
DGtal::QSH< TSpace, TInputValue, TOutputValue > Struct Template Reference

QSH : Quasi Shears represents a bijective rotation through shears. More...

#include <DGtal/images/bijectiveRotations/QSH.h>

Public Member Functions

 BOOST_CONCEPT_ASSERT ((concepts::CSpace< TSpace >))
 Checking concepts. More...
 
 BOOST_STATIC_ASSERT ((TSpace::dimension==2))
 
 BOOST_STATIC_ASSERT ((TOutputValue::dimension==2))
 
 BOOST_STATIC_ASSERT ((TInputValue::dimension==2))
 
TOutputValue hqs (const TOutputValue X, const double a, const double b, const double c) const
 
TOutputValue vqs (const TOutputValue X, const double a, const double b, const double c) const
 
TOutputValue hqs_p (const TOutputValue X, const double ap, const double bp, const double omega) const
 
TOutputValue vqs_p (const TOutputValue X, const double a, const double bp, const double omega) const
 
template<typename Img >
Img rotateImage (Img img) const
 
 QSH (double ang, TOutputValue ptCenter)
 
void initQSHRotation ()
 init a QSH rotation using Andres' parameters More...
 
double angle () const
 
void set_angle (const double new_angle)
 set rotation angle More...
 
TOutputValue center () const
 
TOutputValue & center ()
 
TOutputValue rotate (const TInputValue &p) const
 
TOutputValue operator() (const TInputValue &p) const
 
std::string tostring () const
 
template<typename TImage >
TImage rotateImage (const TImage img) const
 

Protected Attributes

double my_angle
 The angle of rotation. More...
 
TOutputValue my_center
 The center of rotation. More...
 

Private Attributes

const double omega =1<<15
 shears variables More...
 
double a
 
double aprime
 
double bprime
 

Detailed Description

template<typename TSpace, typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
struct DGtal::QSH< TSpace, TInputValue, TOutputValue >

QSH : Quasi Shears represents a bijective rotation through shears.

Description of template struct CDLR

Template Parameters
TSpacea 2 dimensional space.
TInputValuetype of the input point e.g., TSpace::RealPoint.
TOutputValuetype of the output point e.g., TSpace::Point

Definition at line 50 of file QSH.h.

Constructor & Destructor Documentation

◆ QSH()

template<typename TSpace , typename TInputValue , typename TOutputValue >
DGtal::QSH< TSpace, TInputValue, TOutputValue >::QSH ( double  ang,
TOutputValue  ptCenter 
)

QSH Constructor.

Parameters
angthe angle given in radians.
ptCenterthe center of rotation.

Definition at line 132 of file QSH.h.

132  :my_angle(ang),my_center(ptCenter){
133  initQSHRotation();
134 }
double my_angle
The angle of rotation.
Definition: QSH.h:116
TOutputValue my_center
The center of rotation.
Definition: QSH.h:118
void initQSHRotation()
init a QSH rotation using Andres' parameters
Definition: QSH.h:85

References DGtal::QSH< TSpace, TInputValue, TOutputValue >::initQSHRotation().

Member Function Documentation

◆ angle()

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
double DGtal::QSH< TSpace, TInputValue, TOutputValue >::angle ( ) const
inline
Returns
the angle of rotation.

Definition at line 92 of file QSH.h.

92 {return my_angle;};

References DGtal::QSH< TSpace, TInputValue, TOutputValue >::my_angle.

◆ BOOST_CONCEPT_ASSERT()

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
DGtal::QSH< TSpace, TInputValue, TOutputValue >::BOOST_CONCEPT_ASSERT ( (concepts::CSpace< TSpace >)  )

Checking concepts.

◆ BOOST_STATIC_ASSERT() [1/3]

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
DGtal::QSH< TSpace, TInputValue, TOutputValue >::BOOST_STATIC_ASSERT ( (TInputValue::dimension==2)  )

◆ BOOST_STATIC_ASSERT() [2/3]

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
DGtal::QSH< TSpace, TInputValue, TOutputValue >::BOOST_STATIC_ASSERT ( (TOutputValue::dimension==2)  )

◆ BOOST_STATIC_ASSERT() [3/3]

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
DGtal::QSH< TSpace, TInputValue, TOutputValue >::BOOST_STATIC_ASSERT ( (TSpace::dimension==2)  )

◆ center() [1/2]

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
TOutputValue& DGtal::QSH< TSpace, TInputValue, TOutputValue >::center ( )
inline
Returns
a reference to the centre of rotation

Definition at line 101 of file QSH.h.

101 {return my_center;};

References DGtal::QSH< TSpace, TInputValue, TOutputValue >::my_center.

◆ center() [2/2]

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
TOutputValue DGtal::QSH< TSpace, TInputValue, TOutputValue >::center ( ) const
inline
Returns
the centre of rotation

Definition at line 99 of file QSH.h.

99 {return my_center;};

References DGtal::QSH< TSpace, TInputValue, TOutputValue >::my_center.

◆ hqs()

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
TOutputValue DGtal::QSH< TSpace, TInputValue, TOutputValue >::hqs ( const TOutputValue  X,
const double  a,
const double  b,
const double  c 
) const
inline

Definition at line 60 of file QSH.h.

60  {
61  return TOutputValue{X[0] + static_cast<int>(round((a*X[1]+c)/b)),X[1]};
62  }

Referenced by DGtal::QSH< TSpace, TInputValue, TOutputValue >::hqs_p().

◆ hqs_p()

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
TOutputValue DGtal::QSH< TSpace, TInputValue, TOutputValue >::hqs_p ( const TOutputValue  X,
const double  ap,
const double  bp,
const double  omega 
) const
inline

Definition at line 67 of file QSH.h.

67  {
68  return hqs(X, -ap, bp, 0.0);
69  }
TOutputValue hqs(const TOutputValue X, const double a, const double b, const double c) const
Definition: QSH.h:60

References DGtal::QSH< TSpace, TInputValue, TOutputValue >::hqs().

◆ initQSHRotation()

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
void DGtal::QSH< TSpace, TInputValue, TOutputValue >::initQSHRotation ( )
inline

init a QSH rotation using Andres' parameters

Definition at line 85 of file QSH.h.

85  {
86  a = round(omega*std::sin(my_angle));
87  aprime = round(omega*std::sin(my_angle/2.0));
88  bprime = round(omega*std::cos(my_angle/2.0));
89  }
const double omega
shears variables
Definition: QSH.h:123
double bprime
Definition: QSH.h:126
double aprime
Definition: QSH.h:125

References DGtal::QSH< TSpace, TInputValue, TOutputValue >::aprime, DGtal::QSH< TSpace, TInputValue, TOutputValue >::bprime, DGtal::QSH< TSpace, TInputValue, TOutputValue >::my_angle, and DGtal::QSH< TSpace, TInputValue, TOutputValue >::omega.

Referenced by DGtal::QSH< TSpace, TInputValue, TOutputValue >::QSH(), and DGtal::QSH< TSpace, TInputValue, TOutputValue >::set_angle().

◆ operator()()

template<typename TSpace , typename TInputValue , typename TOutputValue >
TOutputValue DGtal::QSH< TSpace, TInputValue, TOutputValue >::operator() ( const TInputValue &  p) const

Definition at line 144 of file QSH.h.

144  {
145 
146  TOutputValue pcentered = p-my_center;
147 
148  TOutputValue y1 = hqs_p(pcentered, aprime, bprime, omega);
149  TOutputValue y2 = vqs_p(y1, a, bprime, omega);
150  TOutputValue y = hqs_p(y2, aprime, bprime, omega);
151  return y+my_center;
152 }
TOutputValue vqs_p(const TOutputValue X, const double a, const double bp, const double omega) const
Definition: QSH.h:70
TOutputValue hqs_p(const TOutputValue X, const double ap, const double bp, const double omega) const
Definition: QSH.h:67

◆ rotate()

template<typename TSpace , typename TInputValue , typename TOutputValue >
TOutputValue DGtal::QSH< TSpace, TInputValue, TOutputValue >::rotate ( const TInputValue &  p) const
Parameters
pa lattice point
Returns
the rotation of the point p according to the current angle and center.

Definition at line 139 of file QSH.h.

139  {
140  return this->operator()(p);
141 }
TOutputValue operator()(const TInputValue &p) const
Definition: QSH.h:144

◆ rotateImage() [1/2]

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
template<typename TImage >
TImage DGtal::QSH< TSpace, TInputValue, TOutputValue >::rotateImage ( const TImage  img) const

Definition at line 158 of file QSH.h.

158  {
159  typedef typename TImage::Domain TDomain;
161  typedef std::pair < typename TSpace::Point, typename TSpace::Point > Bounds;
162 
163 
164  MyDomainTransformer domainTransformer ( *this );
165  Bounds bounds = domainTransformer ( img.domain() );
166  TDomain transformedDomain ( bounds.first, bounds.second );
167  TImage rotatedImage ( transformedDomain );
168 
169 
170 
171  for (typename TDomain::ConstIterator it = img.domain().begin(); it != img.domain().end(); ++it )
172  {
173  rotatedImage.setValue((*this)(*it),img(*it));
174  }
175 
176  return rotatedImage;
177 }
Aim: implements bounds of transformed domain.
MyDigitalSurface::ConstIterator ConstIterator
HyperRectDomain< Space > Domain

◆ rotateImage() [2/2]

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
template<typename Img >
Img DGtal::QSH< TSpace, TInputValue, TOutputValue >::rotateImage ( Img  img) const

◆ set_angle()

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
void DGtal::QSH< TSpace, TInputValue, TOutputValue >::set_angle ( const double  new_angle)
inline

◆ tostring()

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
std::string DGtal::QSH< TSpace, TInputValue, TOutputValue >::tostring ( ) const
inline

Definition at line 110 of file QSH.h.

110  {
111  return {"QSH"};
112  }

◆ vqs()

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
TOutputValue DGtal::QSH< TSpace, TInputValue, TOutputValue >::vqs ( const TOutputValue  X,
const double  a,
const double  b,
const double  c 
) const
inline

Definition at line 63 of file QSH.h.

63  {
64  return TOutputValue{X[0], X[1] + static_cast<int>((round((a*X[0]+c)/b)))};
65  }

Referenced by DGtal::QSH< TSpace, TInputValue, TOutputValue >::vqs_p().

◆ vqs_p()

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
TOutputValue DGtal::QSH< TSpace, TInputValue, TOutputValue >::vqs_p ( const TOutputValue  X,
const double  a,
const double  bp,
const double  omega 
) const
inline

Definition at line 70 of file QSH.h.

70  {
71  return vqs(X,a, omega, round(omega/2.0));
72  }
TOutputValue vqs(const TOutputValue X, const double a, const double b, const double c) const
Definition: QSH.h:63

References DGtal::QSH< TSpace, TInputValue, TOutputValue >::omega, and DGtal::QSH< TSpace, TInputValue, TOutputValue >::vqs().

Field Documentation

◆ a

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
double DGtal::QSH< TSpace, TInputValue, TOutputValue >::a
private

Definition at line 124 of file QSH.h.

◆ aprime

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
double DGtal::QSH< TSpace, TInputValue, TOutputValue >::aprime
private

◆ bprime

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
double DGtal::QSH< TSpace, TInputValue, TOutputValue >::bprime
private

◆ my_angle

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
double DGtal::QSH< TSpace, TInputValue, TOutputValue >::my_angle
protected

◆ my_center

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
TOutputValue DGtal::QSH< TSpace, TInputValue, TOutputValue >::my_center
protected

The center of rotation.

Definition at line 118 of file QSH.h.

Referenced by DGtal::QSH< TSpace, TInputValue, TOutputValue >::center().

◆ omega

template<typename TSpace , typename TInputValue = typename TSpace::Point, typename TOutputValue = typename TSpace::Point>
const double DGtal::QSH< TSpace, TInputValue, TOutputValue >::omega =1<<15
private

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