DGtal  0.9.3beta
Public Types | Public Member Functions | Private Attributes
DGtal::functors::SliceRotator2D< TDomain3D, TInteger > Class Template Reference

#include <DGtal/kernel/BasicPointFunctors.h>

Collaboration diagram for DGtal::functors::SliceRotator2D< TDomain3D, TInteger >:
[legend]

Public Types

typedef SpaceND< 3, TInteger > Space
 
typedef Space::Dimension Dimension
 
typedef Space::Point Point
 
typedef Space::Integer Integer
 

Public Member Functions

 SliceRotator2D (const Dimension &dimAdded, const TDomain3D &aDomain3DImg, const Integer &sliceIndex, const Dimension &dimRotated, double rotationAngle)
 
 SliceRotator2D (const Dimension &dimAdded, const TDomain3D &aDomain3DImg, const Integer &sliceIndex, const Dimension &dimRotated, double rotationAngle, const Point &defaultPoint)
 
 SliceRotator2D (const Dimension &dimAdded, const TDomain3D &aDomain3DImg, const Integer &sliceIndex, const Dimension &dimRotated, const Point &ptCenter, double rotationAngle, const Point &defaultPoint)
 
 SliceRotator2D (const Dimension &dimAdded, const TDomain3D &aDomain3DImg, const Integer &sliceIndex, const Dimension &dimRotated, const Point &ptCenter, double rotationAngle)
 
template<typename TPointDimMinus >
Point operator() (const TPointDimMinus &aPoint) const
 

Private Attributes

Dimension myPosDimAdded
 
Integer mySliceIndex
 
TDomain3D myDomain
 
Dimension myDimRotated
 
double myRotationAngle
 
PointVector< 3, double > myCenter
 
Point myDefaultPoint
 

Detailed Description

template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
class DGtal::functors::SliceRotator2D< TDomain3D, TInteger >

Special Point Functor that adds one dimension to a 2D point and apply on it a rotation of angle alpha according to a given direction and the domain center. It also checks if the resulting point is inside the 3D domain, else it returns a particular point (by default the point at domain origin (from the domain method lowerBound()).

Description of template class 'SliceRotator2D'

Ex: a Point P (10, 9) in the domain (defined (0,0,0) (10,10,10)) given in 3D by adding the dimension in Z (2) with slice num 7: => P(10, 9, 7) and after a rotation of PI from center of slice domain (5,5, 7) will give P(0,1,7). To apply this example you can test it with:

// Defining the domain
PointVector<3, int> pt1(0,0, 0);
PointVector<3, int> pt2(10,10, 10);
HyperRectDomain<SpaceND<3, int> > domain (pt1, pt2);
// The functor on axis rotation set to 2 with new Z slice num=7 and angle 3.15:
SliceRotator2D< HyperRectDomain<SpaceND<3, int> >, int> sliceRot2(2, domain, 7, 2, 3.14);
PointVector<2, int> pt_2(10, 9);
trace.info() << sliceRot2(pt_2);
Template Parameters
TDomain3Dthe type of the 3d domain.
TIntegerspecifies the integer number type used to define the space.

Definition at line 198 of file BasicPointFunctors.h.

Member Typedef Documentation

template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
typedef Space::Dimension DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::Dimension

Definition at line 203 of file BasicPointFunctors.h.

template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
typedef Space::Integer DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::Integer

Definition at line 205 of file BasicPointFunctors.h.

template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
typedef Space::Point DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::Point

Definition at line 204 of file BasicPointFunctors.h.

template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
typedef SpaceND< 3, TInteger> DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::Space

Definition at line 202 of file BasicPointFunctors.h.

Constructor & Destructor Documentation

template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::SliceRotator2D ( const Dimension dimAdded,
const TDomain3D &  aDomain3DImg,
const Integer sliceIndex,
const Dimension dimRotated,
double  rotationAngle 
)
inline

Constructor. (default point is defined from lower point of the domain)

Parameters
dimAddedthe index of the new dimension inserted.
aDomain3DImgthe 3D domain used to keep the resulting point in the domain.
sliceIndexthe value that is used to fill the dimension for a given N-1 point (equivalently the slice index).
dimRotatedthe index of the rotation axis.
rotationAnglethe angle of rotation (in radians).

Definition at line 216 of file BasicPointFunctors.h.

References DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myCenter.

218  :
219  myPosDimAdded(dimAdded), mySliceIndex(sliceIndex), myDomain(aDomain3DImg),
220  myDimRotated(dimRotated), myRotationAngle(rotationAngle), myDefaultPoint (aDomain3DImg.lowerBound())
221  {
222  myCenter[0] = aDomain3DImg.lowerBound()[0]+((aDomain3DImg.upperBound())[0]-(aDomain3DImg.lowerBound())[0])/2.0;
223  myCenter[1] = aDomain3DImg.lowerBound()[1]+((aDomain3DImg.upperBound())[1]-(aDomain3DImg.lowerBound())[1])/2.0;
224  myCenter[2] = aDomain3DImg.lowerBound()[2]+((aDomain3DImg.upperBound())[2]-(aDomain3DImg.lowerBound())[2])/2.0;
225  myCenter[dimAdded]=sliceIndex;
226  };
PointVector< 3, double > myCenter
template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::SliceRotator2D ( const Dimension dimAdded,
const TDomain3D &  aDomain3DImg,
const Integer sliceIndex,
const Dimension dimRotated,
double  rotationAngle,
const Point defaultPoint 
)
inline

Constructor.

Parameters
dimAddedthe index of the new dimension inserted.
aDomain3DImgthe 3D domain used to keep the resulting point in the domain.
sliceIndexthe value that is used to fill the dimension for a given N-1 point (equivalently the slice index).
dimRotatedthe index of the rotation axis.
rotationAnglethe angle of rotation (in radians).
defaultPointthe point given when the resulting point is outside the domain.

Definition at line 238 of file BasicPointFunctors.h.

References DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myCenter.

240  :
241  myPosDimAdded(dimAdded), mySliceIndex(sliceIndex), myDomain(aDomain3DImg),
242  myDimRotated(dimRotated), myRotationAngle(rotationAngle), myDefaultPoint (defaultPoint)
243  {
244  myCenter[0] = aDomain3DImg.lowerBound()[0]+((aDomain3DImg.upperBound())[0]-(aDomain3DImg.lowerBound())[0])/2.0;
245  myCenter[1] = aDomain3DImg.lowerBound()[1]+((aDomain3DImg.upperBound())[1]-(aDomain3DImg.lowerBound())[1])/2.0;
246  myCenter[2] = aDomain3DImg.lowerBound()[2]+((aDomain3DImg.upperBound())[2]-(aDomain3DImg.lowerBound())[2])/2.0;
247  myCenter[dimAdded]=sliceIndex;
248  };
PointVector< 3, double > myCenter
template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::SliceRotator2D ( const Dimension dimAdded,
const TDomain3D &  aDomain3DImg,
const Integer sliceIndex,
const Dimension dimRotated,
const Point ptCenter,
double  rotationAngle,
const Point defaultPoint 
)
inline

Constructor.

Parameters
dimAddedthe index of the new dimension inserted.
aDomain3DImgthe 3D domain used to keep the resulting point in the domain.
sliceIndexthe value that is used to fill the dimension for a given N-1 point (equivalently the slice index).
dimRotatedthe index of the rotation axis.
ptCenterthe rotation center.
rotationAnglethe angle of rotation (in radians).
defaultPointthe point given when the resulting point is outside the domain.

Definition at line 261 of file BasicPointFunctors.h.

262  :
263  myPosDimAdded(dimAdded), mySliceIndex(sliceIndex), myDomain(aDomain3DImg),
264  myDimRotated(dimRotated), myRotationAngle(rotationAngle), myCenter(ptCenter), myDefaultPoint (defaultPoint)
265  {
266  };
PointVector< 3, double > myCenter
template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::SliceRotator2D ( const Dimension dimAdded,
const TDomain3D &  aDomain3DImg,
const Integer sliceIndex,
const Dimension dimRotated,
const Point ptCenter,
double  rotationAngle 
)
inline

Constructor. (default point is defined from lower point of the domain)

Parameters
dimAddedthe index of the new dimension inserted.
aDomain3DImgthe 3D domain used to keep the resulting point in the domain.
sliceIndexthe value that is used to fill the dimension for a given N-1 point (equivalently the slice index).
dimRotatedthe index of the rotation axis.
ptCenterthe rotation center.
rotationAnglethe angle of rotation (in radians).

Definition at line 279 of file BasicPointFunctors.h.

280  :
281  myPosDimAdded(dimAdded), mySliceIndex(sliceIndex), myDomain(aDomain3DImg),
282  myDimRotated(dimRotated), myRotationAngle(rotationAngle), myCenter(ptCenter), myDefaultPoint (aDomain3DImg.lowerBound())
283  {
284  };
PointVector< 3, double > myCenter

Member Function Documentation

template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
template<typename TPointDimMinus >
Point DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::operator() ( const TPointDimMinus &  aPoint) const
inline

The operator just recover the 3D Point associated to the SliceRotator2D parameters.

Parameters
[in]aPointpoint of the input domain (of dimension N-1).
Returns
the point of dimension 3.

Definition at line 294 of file BasicPointFunctors.h.

References DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myCenter, DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myDefaultPoint, DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myDimRotated, DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myDomain, DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myPosDimAdded, DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myRotationAngle, DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::mySliceIndex, and DGtal::PointVector< dim, TEuclideanRing, TContainer >::size().

295  {
296  Point pt;
297  Dimension pos=0;
298  std::vector<Dimension> indexesRotate;
299  for( Dimension i=0; i<pt.size(); i++)
300  {
301  if(i!=myPosDimAdded)
302  {
303  pt[i]= aPoint[pos];
304  pos++;
305  }else
306  {
307  pt[i]=mySliceIndex;
308  }
309  }
310  for( Dimension i=0; i<pt.size(); i++)
311  {
312  if(i!=myDimRotated)
313  indexesRotate.push_back(i);
314  }
315  double d1 = pt[indexesRotate[0]] - myCenter[indexesRotate[0]];
316  double d2 = pt[indexesRotate[1]] - myCenter[indexesRotate[1]];
317 
318  pt[indexesRotate[0]] = myCenter[indexesRotate[0]] + static_cast<Integer>(floor(d1*cos(myRotationAngle)-d2*sin(myRotationAngle) ));
319  pt[indexesRotate[1]] = myCenter[indexesRotate[1]] + static_cast<Integer>(floor(d1*sin(myRotationAngle)+d2*cos(myRotationAngle) ));
320 
321  if(myDomain.isInside(pt))
322  return pt;
323  else
324  return myDefaultPoint;
325  }
PointVector< 3, double > myCenter

Field Documentation

template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
PointVector<3, double> DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myCenter
private
template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
Point DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myDefaultPoint
private
template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
Dimension DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myDimRotated
private
template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
TDomain3D DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myDomain
private
template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
Dimension DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myPosDimAdded
private
template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
double DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myRotationAngle
private
template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
Integer DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::mySliceIndex
private

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