DGtal 2.1.0
Loading...
Searching...
No Matches
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, bool keepInside=true)
 
 SliceRotator2D (const Dimension &dimAdded, const TDomain3D &aDomain3DImg, const Integer &sliceIndex, const Dimension &dimRotated, double rotationAngle, const Point &defaultPoint, bool keepInside=true)
 
 SliceRotator2D (const Dimension &dimAdded, const TDomain3D &aDomain3DImg, const Integer &sliceIndex, const Dimension &dimRotated, const Point &ptCenter, double rotationAngle, const Point &defaultPoint, bool keepInside=true)
 
 SliceRotator2D (const Dimension &dimAdded, const TDomain3D &aDomain3DImg, const Integer &sliceIndex, const Dimension &dimRotated, const Point &ptCenter, double rotationAngle, bool keepInside=true)
 
template<typename TPointDimMinus >
Point operator() (const TPointDimMinus &aPoint) const
 

Data Fields

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

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.
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
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,
bool  keepInside = true 
)
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).
keepInsideif true, the resulting point will be forced to be inside the domain.

Definition at line 219 of file BasicPointFunctors.h.

221 :
222 myPosDimAdded(dimAdded), mySliceIndex(sliceIndex), myDomain(aDomain3DImg),
223 myDimRotated(dimRotated), myRotationAngle(rotationAngle), myDefaultPoint (aDomain3DImg.lowerBound()), myKeepInsideDom(keepInside)
224 {
225 myCenter[0] = aDomain3DImg.lowerBound()[0]+((aDomain3DImg.upperBound())[0]-(aDomain3DImg.lowerBound())[0])/2.0;
226 myCenter[1] = aDomain3DImg.lowerBound()[1]+((aDomain3DImg.upperBound())[1]-(aDomain3DImg.lowerBound())[1])/2.0;
227 myCenter[2] = aDomain3DImg.lowerBound()[2]+((aDomain3DImg.upperBound())[2]-(aDomain3DImg.lowerBound())[2])/2.0;
228 myCenter[dimAdded]=sliceIndex;
229 };
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,
bool  keepInside = true 
)
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.
keepInsideif true, the resulting point will be forced to be inside the domain.

Definition at line 242 of file BasicPointFunctors.h.

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

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,
bool  keepInside = true 
)
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.
keepInsideif true, the resulting point will be forced to be inside the domain.

Definition at line 266 of file BasicPointFunctors.h.

268 :
269 myPosDimAdded(dimAdded), mySliceIndex(sliceIndex), myDomain(aDomain3DImg),
270 myDimRotated(dimRotated), myRotationAngle(rotationAngle), myCenter(ptCenter), myDefaultPoint (defaultPoint), myKeepInsideDom(keepInside)
271 {
272 };

◆ 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,
bool  keepInside = true 
)
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).
keepInsideif true, the resulting point will be forced to be inside the domain.

Definition at line 286 of file BasicPointFunctors.h.

287 :
288 myPosDimAdded(dimAdded), mySliceIndex(sliceIndex), myDomain(aDomain3DImg),
289 myDimRotated(dimRotated), myRotationAngle(rotationAngle), myCenter(ptCenter), myDefaultPoint (aDomain3DImg.lowerBound()),
290 myKeepInsideDom(keepInside)
291 {
292 };

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

303 {
304 Point pt;
305 Dimension pos=0;
306 std::vector<Dimension> indexesRotate;
307 for( Dimension i=0; i<pt.size(); i++)
308 {
309 if(i!=myPosDimAdded)
310 {
311 pt[i]= aPoint[pos];
312 pos++;
313 }else
314 {
315 pt[i]=mySliceIndex;
316 }
317 }
318 for( Dimension i=0; i<pt.size(); i++)
319 {
320 if(i!=myDimRotated)
321 indexesRotate.push_back(i);
322 }
323 double d1 = pt[indexesRotate[0]] - myCenter[indexesRotate[0]];
324 double d2 = pt[indexesRotate[1]] - myCenter[indexesRotate[1]];
325
326 pt[indexesRotate[0]] = myCenter[indexesRotate[0]] + static_cast<Integer>(round(d1*cos(myRotationAngle)-d2*sin(myRotationAngle) ));
327 pt[indexesRotate[1]] = myCenter[indexesRotate[1]] + static_cast<Integer>(round(d1*sin(myRotationAngle)+d2*cos(myRotationAngle) ));
328
329 if(!myKeepInsideDom || myDomain.isInside(pt))
330 return pt;
331 else
332 return myDefaultPoint;
333 }
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 >::myKeepInsideDom, 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

◆ myDefaultPoint

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

◆ myDimRotated

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

◆ myDomain

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

◆ myKeepInsideDom

template<typename TDomain3D , typename TInteger = DGtal::Z3i::Integer>
bool DGtal::functors::SliceRotator2D< TDomain3D, TInteger >::myKeepInsideDom = true

◆ myPosDimAdded

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

◆ myRotationAngle

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

◆ mySliceIndex

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

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