template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
class DGtal::functors::Point2DEmbedderIn3D< TDomain3D, TInteger >
Aim: Functor that embeds a 2D point into a 3D space from two axis vectors and an origin point given in the 3D space.
Description of template class 'Point2DEmbedderIn3D'
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())).
It can be used to extract 2D images from volumetric files. For instance (see full example images/extract2DImagesFrom3D.cpp):
- First some image types and ConstImageAdapter are defined to exploit the functor:
- Then, we define the origin point and axis vector used to extract 2D image values and we also deduce the associated 2D domain:
static_cast<int>((ptUpper2-origin).norm())));
- The 2D image we can now be constructed from the embeder and from the ConstImageAdapter class:
ImageAdapterExtractor extractedImage(image, domainImage2D, embedder, idV);
- Alternatively, you can also construct the same functor from a reference center point, a normal, and a size:
ImageAdapterExtractor extractedImage2(image, domainImage2D2, embedder2, idV);
- See also
- tests/kernel/testBasicPointFunctors.cpp
- Template Parameters
-
TDomain3D | the type of the 3d domain. |
TInteger | specifies the integer number type used to define the space. |
- Examples:
- images/extract2DImagesFrom3D.cpp, images/extract2DImagesFrom3DandVisu.cpp, and io/viewers/viewer3D-8bis-2Dimages.cpp.
Definition at line 370 of file BasicPointFunctors.h.
template<typename TDomain3D, typename TInteger = DGtal::Z3i::Integer>
Constructor. Construct the functor from an origin 3D point, an normal vector (normal to the 2D domain), and a width. The points of an 2D domain are embedded in 3D by using a normal vector giving the direction of the 2D domain embedded in the 3D space.
- Parameters
-
aDomain3DImg | the 3D domain used to keep the resulting point in the domain. |
anOriginPoint | the center point given in the 3D domain. |
anNormalVector | the normal vector to the 2d domain embedded in 3D. |
anWidth | the width to determine the 2d domain bounds (the resulting 2d domain will be a square of length anWidth). |
aDefautPoint | the point given when the resulting point is outside the domain (default Point(0,0,0)). |
Definition at line 420 of file BasicPointFunctors.h.
References DGtal::PointVector< dim, TEuclideanRing, TContainer >::norm().
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];
Space::RealPoint myFirstAxisEmbeddedDirection
Aim: Implements basic operations that will be used in Point and Vector classes.
Space::RealPoint mySecondAxisEmbeddedDirection
double norm(const NormType type=L_2) const
Point myOriginPointEmbeddedIn3D