28 #if defined(QSH_RECURSES)
29 #error Recursive header files inclusion detected in QSH.h
37 #include <DGtal/base/Common.h>
38 #include <DGtal/images/RigidTransformation2D.h>
49 template <
typename TSpace,
typename TInputValue =
typename TSpace::Po
int,
typename TOutputValue =
typename TSpace::Po
int>
60 inline TOutputValue
hqs(
const TOutputValue X,
const double a,
const double b,
const double c)
const{
61 return TOutputValue{X[0] +
static_cast<int>(round((a*X[1]+c)/b)),X[1]};
63 inline TOutputValue
vqs(
const TOutputValue X,
const double a,
const double b,
const double c)
const{
64 return TOutputValue{X[0], X[1] +
static_cast<int>((round((a*X[0]+c)/b)))};
67 inline TOutputValue
hqs_p(
const TOutputValue X,
const double ap,
const double bp,
const double omega)
const{
68 return hqs(X, -ap, bp, 0.0);
70 inline TOutputValue
vqs_p(
const TOutputValue X,
const double a,
const double bp,
const double omega)
const{
74 template<
typename Img>
82 QSH(
double ang, TOutputValue ptCenter );
107 TOutputValue
rotate(
const TInputValue& p )
const;
108 TOutputValue
operator()(
const TInputValue& p )
const;
131 template<
typename TSpace,
typename TInputValue,
typename TOutputValue>
138 template<
typename TSpace,
typename TInputValue,
typename TOutputValue>
140 return this->operator()(p);
143 template<
typename TSpace,
typename TInputValue,
typename TOutputValue>
146 TOutputValue pcentered = p-my_center;
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);
156 template<
typename TSpace,
typename TInputValue,
typename TOutputValue>
157 template<
typename TImage>
161 typedef std::pair < typename TSpace::Point, typename TSpace::Point > Bounds;
164 MyDomainTransformer domainTransformer ( *
this );
165 Bounds bounds = domainTransformer ( img.domain() );
166 TDomain transformedDomain ( bounds.first, bounds.second );
167 TImage rotatedImage ( transformedDomain );
173 rotatedImage.setValue((*
this)(*it),img(*it));
Aim: implements bounds of transformed domain.
MyDigitalSurface::ConstIterator ConstIterator
DGtal is the top-level namespace which contains all DGtal functions and types.
QSH : Quasi Shears represents a bijective rotation through shears.
TOutputValue operator()(const TInputValue &p) const
Img rotateImage(Img img) const
TOutputValue center() const
TOutputValue hqs(const TOutputValue X, const double a, const double b, const double c) const
double my_angle
The angle of rotation.
TOutputValue rotate(const TInputValue &p) const
const double omega
shears variables
TOutputValue my_center
The center of rotation.
TOutputValue vqs_p(const TOutputValue X, const double a, const double bp, const double omega) const
std::string tostring() const
BOOST_STATIC_ASSERT((TSpace::dimension==2))
void initQSHRotation()
init a QSH rotation using Andres' parameters
TOutputValue hqs_p(const TOutputValue X, const double ap, const double bp, const double omega) const
QSH(double ang, TOutputValue ptCenter)
BOOST_CONCEPT_ASSERT((concepts::CSpace< TSpace >))
Checking concepts.
TOutputValue vqs(const TOutputValue X, const double a, const double b, const double c) const
void set_angle(const double new_angle)
set rotation angle
BOOST_STATIC_ASSERT((TOutputValue::dimension==2))
BOOST_STATIC_ASSERT((TInputValue::dimension==2))
Aim: Defines the concept describing a digital space, ie a cartesian product of integer lines.
HyperRectDomain< Space > Domain