DGtal 1.3.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Attributes
DGtal::functors::SliceRotator2D< TDomain3D, TInteger > Class Template Reference

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()). More...

#include <DGtal/kernel/BasicPointFunctors.h>

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);
// 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);
Aim: Parallelepidec region of a digital space, model of a 'CDomain'.
Aim: Implements basic operations that will be used in Point and Vector classes.
Definition: PointVector.h:593
std::ostream & info()
Special Point Functor that adds one dimension to a 2D point and apply on it a rotation of angle alpha...
Trace trace
Definition: Common.h:154
Domain domain
Template Parameters
TDomain3Dthe type of the 3d domain.
TIntegerspecifies the integer number type used to define the space.

Definition at line 200 of file BasicPointFunctors.h.

Member Typedef Documentation

◆ Dimension

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

Definition at line 205 of file BasicPointFunctors.h.

◆ Integer

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

Definition at line 207 of file BasicPointFunctors.h.

◆ Point

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

Definition at line 206 of file BasicPointFunctors.h.

◆ Space

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

Definition at line 204 of file BasicPointFunctors.h.

Constructor & Destructor Documentation

◆ SliceRotator2D() [1/4]

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 218 of file BasicPointFunctors.h.

220 :
221 myPosDimAdded(dimAdded), mySliceIndex(sliceIndex), myDomain(aDomain3DImg),
222 myDimRotated(dimRotated), myRotationAngle(rotationAngle), myDefaultPoint (aDomain3DImg.lowerBound())
223 {
224 myCenter[0] = aDomain3DImg.lowerBound()[0]+((aDomain3DImg.upperBound())[0]-(aDomain3DImg.lowerBound())[0])/2.0;
225 myCenter[1] = aDomain3DImg.lowerBound()[1]+((aDomain3DImg.upperBound())[1]-(aDomain3DImg.lowerBound())[1])/2.0;
226 myCenter[2] = aDomain3DImg.lowerBound()[2]+((aDomain3DImg.upperBound())[2]-(aDomain3DImg.lowerBound())[2])/2.0;
227 myCenter[dimAdded]=sliceIndex;
228 };
PointVector< 3, double > myCenter

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

◆ SliceRotator2D() [2/4]

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 240 of file BasicPointFunctors.h.

242 :
243 myPosDimAdded(dimAdded), mySliceIndex(sliceIndex), myDomain(aDomain3DImg),
244 myDimRotated(dimRotated), myRotationAngle(rotationAngle), myDefaultPoint (defaultPoint)
245 {
246 myCenter[0] = aDomain3DImg.lowerBound()[0]+((aDomain3DImg.upperBound())[0]-(aDomain3DImg.lowerBound())[0])/2.0;
247 myCenter[1] = aDomain3DImg.lowerBound()[1]+((aDomain3DImg.upperBound())[1]-(aDomain3DImg.lowerBound())[1])/2.0;
248 myCenter[2] = aDomain3DImg.lowerBound()[2]+((aDomain3DImg.upperBound())[2]-(aDomain3DImg.lowerBound())[2])/2.0;
249 myCenter[dimAdded]=sliceIndex;
250 };

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

◆ SliceRotator2D() [3/4]

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 263 of file BasicPointFunctors.h.

264 :
265 myPosDimAdded(dimAdded), mySliceIndex(sliceIndex), myDomain(aDomain3DImg),
266 myDimRotated(dimRotated), myRotationAngle(rotationAngle), myCenter(ptCenter), myDefaultPoint (defaultPoint)
267 {
268 };

◆ SliceRotator2D() [4/4]

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 281 of file BasicPointFunctors.h.

282 :
283 myPosDimAdded(dimAdded), mySliceIndex(sliceIndex), myDomain(aDomain3DImg),
284 myDimRotated(dimRotated), myRotationAngle(rotationAngle), myCenter(ptCenter), myDefaultPoint (aDomain3DImg.lowerBound())
285 {
286 };

Member Function Documentation

◆ operator()()

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 296 of file BasicPointFunctors.h.

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

References aPoint(), 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().

Field Documentation

◆ myCenter

template<typename TDomain3D , typename TInteger = DGtal::Z3i::Integer>
PointVector<3, double> DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myCenter
private

◆ myDefaultPoint

template<typename TDomain3D , typename TInteger = DGtal::Z3i::Integer>
Point DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myDefaultPoint
private

◆ myDimRotated

template<typename TDomain3D , typename TInteger = DGtal::Z3i::Integer>
Dimension DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myDimRotated
private

◆ myDomain

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

◆ myPosDimAdded

template<typename TDomain3D , typename TInteger = DGtal::Z3i::Integer>
Dimension DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myPosDimAdded
private

◆ myRotationAngle

template<typename TDomain3D , typename TInteger = DGtal::Z3i::Integer>
double DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myRotationAngle
private

◆ mySliceIndex

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: