DGtal  1.5.beta
DigitizedReflection.h
1 
17 #pragma once
18 
28 #if defined(DigitizedReflection_RECURSES)
29 #error Recursive header files inclusion detected in DigitizedReflection.h
30 #else // defined(DigitizedReflection_RECURSES)
32 #define DigitizedReflection_RECURSES
33 
34 #if !defined DigitizedReflection_h
36 #define DigitizedReflection_h
37 
39 // Inclusions
40 #include "GAVector.h"
41 
42 namespace DGtal {
43  template<typename TSpace, typename TInputValue = typename TSpace::RealPoint, typename TOutputValue = typename TSpace::Point>
44  struct Reflection
45  {
47 
49  :normalVector(m){}
50 
55  inline
56  TOutputValue operator()( const TInputValue & aInput ) const
57  {
59  Z2i::RealPoint m_r = Z2i::RealPoint(normalVector.my_gavec[0],normalVector.my_gavec[1]);
60  Z2i::RealPoint x_r = Z2i::RealPoint(aInput[0],aInput[1]);
61  Z2i::RealPoint p=x_r - 2.0*((x_r[0]*m_r[0] + x_r[1]*m_r[1])/(m_r[0]*m_r[0] + m_r[1]*m_r[1]))*m_r;
62  return roundingOpe(p);
63  }
64 
65  };
66 }
67 #endif //DigitizedReflection
68 
69 #undef DigitizedReflection_RECURSES
70 #endif // else defined(DigitizedReflection_RECURSES)
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
Space::RealPoint RealPoint
Definition: StdDefs.h:97
DGtal is the top-level namespace which contains all DGtal functions and types.
TOutputValue operator()(const TInputValue &aInput) const
Reflection(const GAVector< TSpace > &m=GAVector< TSpace >())
GAVector< TSpace > normalVector