32 #if defined(BasicPointFunctors_RECURSES) 33 #error Recursive header files inclusion detected in BasicPointFunctors.h 34 #else // defined(BasicPointFunctors_RECURSES) 36 #define BasicPointFunctors_RECURSES 38 #if !defined BasicPointFunctors_h 40 #define BasicPointFunctors_h 46 #include "DGtal/base/Common.h" 47 #include "DGtal/helpers/StdDefs.h" 48 #include "DGtal/kernel/SpaceND.h" 49 #include "DGtal/kernel/NumberTraits.h" 50 #include "DGtal/base/BasicBoolFunctors.h" 51 #include "DGtal/kernel/CPointPredicate.h" 52 #include "DGtal/base/CQuantity.h" 53 #include "DGtal/kernel/domains/CDomain.h" 54 #include "DGtal/base/ConstAlias.h" 103 template <
typename S = SpaceND< 2, DGtal::Z2i::Integer > >
123 template<
typename TIterator>
124 void init (
const TIterator& itb,
const TIterator& ite );
145 template<
typename TInputPo
int>
197 template <
typename TDomain3D,
typename TInteger = DGtal::Z3i::Integer >
218 double rotationAngle):
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;
240 double rotationAngle,
const Point &defaultPoint):
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;
262 const Dimension &dimRotated,
const Point &ptCenter,
double rotationAngle,
const Point &defaultPoint):
280 const Dimension &dimRotated,
const Point &ptCenter,
double rotationAngle):
292 template <
typename TPo
intDimMinus>
298 std::vector<Dimension> indexesRotate;
313 indexesRotate.push_back(i);
315 double d1 = pt[indexesRotate[0]] -
myCenter[indexesRotate[0]];
316 double d2 = pt[indexesRotate[1]] -
myCenter[indexesRotate[1]];
369 template <
typename TDomain3D,
typename TInteger = DGtal::Z3i::Integer >
389 const Point &anOriginPoint,
const Point &anUpperPointOnAxis1,
390 const Point &anUpperPointOnAxis2,
395 anUpperPointOnAxis1[1]-anOriginPoint[1],
396 anUpperPointOnAxis1[2]-anOriginPoint[2])),
398 anUpperPointOnAxis2[1]-anOriginPoint[1],
399 anUpperPointOnAxis2[2]-anOriginPoint[2]))
426 double d = -anNormalVector[0]*anOriginPoint[0] - anNormalVector[1]*anOriginPoint[1] - anNormalVector[2]*anOriginPoint[2];
428 if(anNormalVector[0]!=0){
429 pRefOrigin [0]= -d/anNormalVector[0];
432 if(pRefOrigin==anOriginPoint){
435 }
else if (anNormalVector[1]!=0){
437 pRefOrigin [1]= -d/anNormalVector[1];
439 if(pRefOrigin==anOriginPoint){
442 }
else if (anNormalVector[2]!=0){
445 pRefOrigin [2]= -d/anNormalVector[2];
446 if(pRefOrigin==anOriginPoint){
451 uDir1=(pRefOrigin-anOriginPoint)/((pRefOrigin-anOriginPoint).norm());
453 uDir2[0] = uDir1[1]*anNormalVector[2]-uDir1[2]*anNormalVector[1];
454 uDir2[1] = uDir1[2]*anNormalVector[0]-uDir1[0]*anNormalVector[2];
455 uDir2[2] = uDir1[0]*anNormalVector[1]-uDir1[1]*anNormalVector[0];
475 template <
typename TPo
int2D>
488 if(
myDomain.isInside(pt)|| !checkInsideDomain)
495 trace.
warning() <<
"Warning pt outside the 3D domain " << pt << std::endl;
521 template<
typename TPo
intPredicate,
typename TDomain,
typename TValue=
typename TDomain::Integer >
541 const Value aTrueValue,
const Value aFalseValue );
588 template <
typename TDomain,
typename TInteger = DGtal::
int32_t,
typename TValue = DGtal::u
int32_t >
593 typedef typename TDomain::Size
Size;
613 Point domainUpperBound=aSourceDomain.upperBound();
614 Point domainLowerBound=aSourceDomain.lowerBound();
617 domainLowerBound[
dim] /= aGridSize[
dim];
618 domainUpperBound[
dim] /= aGridSize[
dim];
647 trace.
error() <<
" The point is not in the source domain: "<<
aPoint << std::endl;
706 template <
typename TDomain>
711 typedef typename TDomain::Size
Size;
773 #include "DGtal/kernel/BasicPointFunctors.ih" 777 #endif // !defined BasicPointFunctors_h 778 #undef BasicPointFunctors_RECURSES 779 #endif // else defined(BasicPointFunctors_RECURSES)
static const Dimension dimension
static constants to store the dimension.
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< PointPredicate >))
MyDigitalSurface::ConstIterator ConstIterator
static Self diagonal(Component val=1)
Space::Dimension Dimension
Aim: SpaceND is a utility class that defines the fundamental structure of a Digital Space in ND...
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
Space::Dimension Dimension
DGtal::uint32_t Dimension
SliceRotator2D(const Dimension &dimAdded, const TDomain3D &aDomain3DImg, const Integer &sliceIndex, const Dimension &dimRotated, const Point &ptCenter, double rotationAngle)
PointFunctorFromPointPredicateAndDomain & operator=(const PointFunctorFromPointPredicateAndDomain &other)
Space::RealPoint myFirstAxisEmbeddedDirection
SliceRotator2D(const Dimension &dimAdded, const TDomain3D &aDomain3DImg, const Integer &sliceIndex, const Dimension &dimRotated, const Point &ptCenter, double rotationAngle, const Point &defaultPoint)
void initRemoveOneDim(const Dimension &dimRemoved)
Aim: Functor that maps a point P of dimension i to a point Q of dimension j. The member myDims is an ...
Aim: Functor that subsamples an initial domain by given a grid size and a shift vector. By this way, for a given point considered in a new domain, it allows to recover the point coordinates in the source domain. Such functor can be usefull to apply basic image subsampling in any dimensions by using ImageAdapter class.
const TDomain & getSubSampledDomain()
TDomain myGridSampleDomain
DGtal::Dimension Dimension
Copy of the type used for the dimension.
Space::RealPoint mySecondAxisEmbeddedDirection
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
std::array< Dimension, dimension > myDims
Aim: Defines a predicate on a point.
Aim: Functor that embeds a 2D point into a 3D space from two axis vectors and an origin point given i...
Create a point functor from a point predicate and a domain.
std::vector< TValue > myGridSize
Aim: The traits class for all models of Cinteger.
double norm(const NormType type=L_2) const
SpaceND< 3, TInteger > Space
Point operator()(const TPoint2D &aPoint, bool checkInsideDomain=true) const
SliceRotator2D(const Dimension &dimAdded, const TDomain3D &aDomain3DImg, const Integer &sliceIndex, const Dimension &dimRotated, double rotationAngle, const Point &defaultPoint)
Aim: Functor that flips the domain coordinate system from some selected axis. For instance...
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
Value operator()(const Point &aPoint) const
operator ()
Aim: defines the concept of quantity in DGtal.
Point operator()(const TInputPoint &aPoint) const
Point2DEmbedderIn3D(const TDomain3D &aDomain3DImg, const Point &anOriginPoint, const typename Space::RealPoint &anNormalVector, const typename Point::Component &anWidth, const Point &aDefautPoint=Point(0, 0, 0))
std::vector< Size > myAxisFlipped
TPointPredicate PointPredicate
Point myOriginPointEmbeddedIn3D
DGtal is the top-level namespace which contains all DGtal functions and types.
Space::Dimension Dimension
Point operator()(const Point &aPoint) const
unsigned int dim(const Vector &z)
SliceRotator2D(const Dimension &dimAdded, const TDomain3D &aDomain3DImg, const Integer &sliceIndex, const Dimension &dimRotated, double rotationAngle)
void init(const TIterator &itb, const TIterator &ite)
void initAddOneDim(const Dimension &newDim)
BOOST_STATIC_CONSTANT(Dimension, dimension=Space::dimension)
const PointPredicate * myPtrPredicate
Projector(const Integer &aDefaultInteger=NumberTraits< Integer >::zero())
SpaceND< 3, TInteger > Space
Space::Dimension Dimension
FlipDomainAxis(const TDomain &aSourceDomain, const std::vector< Size > &axisFlipped)
Point2DEmbedderIn3D(const TDomain3D &aDomain3DImg, const Point &anOriginPoint, const Point &anUpperPointOnAxis1, const Point &anUpperPointOnAxis2, const Point &aDefautPoint=Point(0, 0, 0))
PointVector< 3, double > myCenter
PointFunctorFromPointPredicateAndDomain(ConstAlias< PointPredicate > aPtrPredicate, ConstAlias< Domain > aDomain, const Value aTrueValue, const Value aFalseValue)
Constructor.
Point operator()(const TPointDimMinus &aPoint) const
BasicDomainSubSampler(const TDomain &aSourceDomain, const std::vector< TValue > &aGridSize, const Point &aGridShift)
Special Point Functor that adds one dimension to a 2D point and apply on it a rotation of angle alpha...
Point operator()(const Point &aPoint) const
Integer Component
Type for Vector elements.