32#if defined(BasicPointFunctors_RECURSES)
33#error Recursive header files inclusion detected in BasicPointFunctors.h
36#define BasicPointFunctors_RECURSES
38#if !defined BasicPointFunctors_h
40#define BasicPointFunctors_h
49#include "DGtal/base/Common.h"
50#include "DGtal/helpers/StdDefs.h"
51#include "DGtal/kernel/SpaceND.h"
52#include "DGtal/kernel/NumberTraits.h"
53#include "DGtal/base/BasicBoolFunctors.h"
54#include "DGtal/kernel/CPointPredicate.h"
55#include "DGtal/base/CQuantity.h"
56#include "DGtal/kernel/domains/CDomain.h"
57#include "DGtal/base/ConstAlias.h"
105 template <
typename S = SpaceND< 2, DGtal::Z2i::Integer > >
125 template<
typename TIterator>
126 void init (
const TIterator& itb,
const TIterator& ite );
147 template<
typename TInputPo
int>
199 template <
typename TDomain3D,
typename TInteger = DGtal::Z3i::Integer >
220 double rotationAngle):
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;
242 double rotationAngle,
const Point &defaultPoint):
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;
264 const Dimension &dimRotated,
const Point &ptCenter,
double rotationAngle,
const Point &defaultPoint):
282 const Dimension &dimRotated,
const Point &ptCenter,
double rotationAngle):
294 template <
typename TPo
intDimMinus>
300 std::vector<Dimension> indexesRotate;
315 indexesRotate.push_back(i);
317 double d1 = pt[indexesRotate[0]] -
myCenter[indexesRotate[0]];
318 double d2 = pt[indexesRotate[1]] -
myCenter[indexesRotate[1]];
371 template <
typename TDomain3D,
typename TInteger = DGtal::Z3i::Integer >
391 const Point &anOriginPoint,
const Point &anUpperPointOnAxis1,
392 const Point &anUpperPointOnAxis2,
397 anUpperPointOnAxis1[1]-anOriginPoint[1],
398 anUpperPointOnAxis1[2]-anOriginPoint[2])),
400 anUpperPointOnAxis2[1]-anOriginPoint[1],
401 anUpperPointOnAxis2[2]-anOriginPoint[2]))
428 double d = -aNormalVector[0]*anOriginPoint[0] - aNormalVector[1]*anOriginPoint[1] - aNormalVector[2]*anOriginPoint[2];
430 if(aNormalVector[0]!=0){
431 pRefOrigin [0]= -d/aNormalVector[0];
434 if(pRefOrigin==anOriginPoint){
437 }
else if (aNormalVector[1]!=0){
439 pRefOrigin [1]= -d/aNormalVector[1];
441 if(pRefOrigin==anOriginPoint){
444 }
else if (aNormalVector[2]!=0){
447 pRefOrigin [2]= -d/aNormalVector[2];
448 if(pRefOrigin==anOriginPoint){
453 uDir1=(pRefOrigin-anOriginPoint)/((pRefOrigin-anOriginPoint).norm());
455 uDir2[0] = uDir1[1]*aNormalVector[2]-uDir1[2]*aNormalVector[1];
456 uDir2[1] = uDir1[2]*aNormalVector[0]-uDir1[0]*aNormalVector[2];
457 uDir2[2] = uDir1[0]*aNormalVector[1]-uDir1[1]*aNormalVector[0];
489 uDir1 = orientXaxisVector/orientXaxisVector.
norm();
491 uDir2[0] = uDir1[1]*aNormalVector[2]-uDir1[2]*aNormalVector[1];
492 uDir2[1] = uDir1[2]*aNormalVector[0]-uDir1[0]*aNormalVector[2];
493 uDir2[2] = uDir1[0]*aNormalVector[1]-uDir1[1]*aNormalVector[0];
508 template <
typename TPo
int2D>
521 if(
myDomain.isInside(pt)|| !checkInsideDomain)
528 trace.
warning() <<
"Warning pt outside the 3D domain " << pt << std::endl;
569 template<
typename TPo
intPredicate,
typename TDomain,
typename TValue=
typename TDomain::Integer >
589 const Value aTrueValue,
const Value aFalseValue );
636 template <
typename TDomain,
typename TInteger = DGtal::
int32_t,
typename TValue =
typename TDomain::Size >
640 typedef typename TDomain::Space
Space;
641 typedef typename TDomain::Size
Size;
662 Point domainUpperBound=aSourceDomain.upperBound();
663 Point domainLowerBound=aSourceDomain.lowerBound();
698 trace.
error() <<
" The point is not in the source domain: "<<
aPoint << std::endl;
757 template <
typename TDomain>
761 typedef typename TDomain::Space
Space;
762 typedef typename TDomain::Size
Size;
811 template <
typename TRealVector,
typename TVector>
819 for (
unsigned int i = 0; i < TVector::dimension; i++ )
820 out[i] = std::round ( point[i] );
831#include "DGtal/kernel/BasicPointFunctors.ih"
836#undef BasicPointFunctors_RECURSES
Aim: This class encapsulates its parameter class so that to indicate to the user that the object/poin...
double norm(const NormType type=L_2) const
static Self diagonal(Component val=1)
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
static const Dimension dimension
static constants to store the dimension.
DGtal::Dimension Dimension
Copy of the type used for the dimension.
Aim: Functor that subsamples an initial domain by given a grid size and a shift vector....
Space::Dimension Dimension
Point operator()(const Point &aPoint) const
TDomain myGridSampleDomain
TDomain::Integer IntergerDom
const TDomain & getSubSampledDomain()
std::vector< TValue > myGridSize
BasicDomainSubSampler(const TDomain &aSourceDomain, const std::vector< TValue > &aGridSize, const Point &aGridShift)
Aim: Functor that flips the domain coordinate system from some selected axis. For instance,...
Point operator()(const Point &aPoint) const
FlipDomainAxis(const TDomain &aSourceDomain, const std::vector< Dimension > &axisFlipped)
Space::Dimension Dimension
std::vector< Dimension > myAxisFlipped
Aim: Functor that embeds a 2D point into a 3D space from two axis vectors and an origin point given i...
Space::RealPoint myOriginPointEmbeddedIn3D
Space::RealPoint myFirstAxisEmbeddedDirection
void shiftOriginPoint(const typename Space::RealPoint &shift)
Point2DEmbedderIn3D(const TDomain3D &aDomain3DImg, const Point &anOriginPoint, const Point &anUpperPointOnAxis1, const Point &anUpperPointOnAxis2, const Point &aDefautPoint=Point(0, 0, 0))
Point2DEmbedderIn3D(const TDomain3D &aDomain3DImg, const Point &anOriginPoint, const typename Space::RealPoint &aNormalVector, const typename Point::Component &aWidth, const Point &aDefautPoint=Point(0, 0, 0))
Space::RealPoint mySecondAxisEmbeddedDirection
SpaceND< 3, TInteger > Space
Point2DEmbedderIn3D(const TDomain3D &aDomain3DImg, const Point &anOriginPoint, const typename Space::RealPoint &aNormalVector, const typename Space::RealPoint &orientXaxisVector, const typename Point::Component &aWidth, const Point &aDefautPoint=Point(0, 0, 0))
Point operator()(const TPoint2D &aPoint, bool checkInsideDomain=true) const
Special Point Functor that adds one dimension to a 2D point and apply on it a rotation of angle alpha...
Space::Dimension Dimension
PointVector< 3, double > myCenter
Point operator()(const TPointDimMinus &aPoint) const
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, const Point &ptCenter, double rotationAngle, const Point &defaultPoint)
SpaceND< 3, TInteger > Space
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)
DGtal is the top-level namespace which contains all DGtal functions and types.
DGtal::uint32_t Dimension
Aim: The traits class for all models of Cinteger.
Aim: This concept represents a digital domain, i.e. a non mutable subset of points of the given digit...
Aim: Defines a predicate on a point.
Aim: defines the concept of quantity in DGtal.
Create a point functor from a point predicate and a domain.
BOOST_CONCEPT_ASSERT((concepts::CDomain< Domain >))
Value operator()(const Point &aPoint) const
operator ()
TPointPredicate PointPredicate
BOOST_CONCEPT_ASSERT((concepts::CQuantity< Value >))
PointFunctorFromPointPredicateAndDomain(ConstAlias< PointPredicate > aPtrPredicate, ConstAlias< Domain > aDomain, const Value aTrueValue, const Value aFalseValue)
Constructor.
PointFunctorFromPointPredicateAndDomain(const PointFunctorFromPointPredicateAndDomain &other)
BOOST_CONCEPT_ASSERT((concepts::CPointPredicate< PointPredicate >))
const PointPredicate * myPtrPredicate
PointFunctorFromPointPredicateAndDomain & operator=(const PointFunctorFromPointPredicateAndDomain &other)
Aim: Functor that maps a point P of dimension i to a point Q of dimension j. The member myDims is an ...
void initAddOneDim(const Dimension &newDim)
void init(const TIterator &itb, const TIterator &ite)
Space::Dimension Dimension
void initRemoveOneDim(const Dimension &dimRemoved)
Projector(const Integer &aDefaultInteger=NumberTraits< Integer >::zero())
Point operator()(const TInputPoint &aPoint) const
BOOST_STATIC_CONSTANT(Dimension, dimension=Space::dimension)
std::array< Dimension, dimension > myDims
TVector operator()(const TRealVector &point) const
BOOST_STATIC_ASSERT((TRealVector::dimension==TVector::dimension))