DGtal 1.4.0
Loading...
Searching...
No Matches
CellGeometry.h
1
17#pragma once
18
31#if defined(CellGeometry_RECURSES)
32#error Recursive header files inclusion detected in CellGeometry.h
33#else // defined(CellGeometry_RECURSES)
35#define CellGeometry_RECURSES
36
37#if !defined CellGeometry_h
39#define CellGeometry_h
40
42// Inclusions
43#include <iostream>
44#include <list>
45#include <vector>
46#include <string>
47#include <unordered_set>
48#include "DGtal/base/Common.h"
49#include "DGtal/kernel/UnorderedSetByBlock.h"
50#include "DGtal/kernel/PointHashFunctions.h"
51#include "DGtal/topology/CCellularGridSpaceND.h"
52#include "DGtal/topology/KhalimskySpaceND.h"
53#include "DGtal/topology/KhalimskyCellHashFunctions.h"
54#include "DGtal/geometry/volumes/BoundedLatticePolytope.h"
55#include "DGtal/geometry/volumes/BoundedRationalPolytope.h"
57
58namespace DGtal
59{
60
62 // template class CellGeometry
73 template < typename TKSpace >
75 {
77
78 public:
80 typedef TKSpace KSpace;
81 typedef typename KSpace::Integer Integer;
82 typedef typename KSpace::Point Point;
83 typedef typename KSpace::Vector Vector;
84 typedef typename KSpace::Cell Cell;
85 typedef typename KSpace::Space Space;
86 typedef typename KSpace::Size Size;
87#ifdef WITH_BIGINTEGER
89#else
91#endif
95
97
98
101
105 ~CellGeometry() = default;
106
111
116 CellGeometry ( const Self & other ) = default;
117
122 CellGeometry ( Self && other ) = default;
123
132 Dimension min_cell_dim = 0,
133 Dimension max_cell_dim = KSpace::dimension,
134 bool verbose = false );
135
141 Self & operator= ( const Self & other ) = default;
142
150 void init( const KSpace & K,
151 Dimension min_cell_dim = 0,
152 Dimension max_cell_dim = KSpace::dimension,
153 bool verbose = false );
155
156 // ----------------------- Cells services ------------------------------
157 public:
160
163 void addCellsTouchingPoint( const Point& p );
164
167 void addCellsTouchingPointel( const Cell& pointel );
168
173 void addCellsTouchingCell( const Cell& c );
174
184 void addCellsTouchingSegment( const Point& a, const Point& b );
185
188 template <typename PointIterator>
189 void addCellsTouchingPoints( PointIterator itB, PointIterator itE );
190
193 template <typename PointelIterator>
194 void addCellsTouchingPointels( PointelIterator itB, PointelIterator itE );
195
200
205
211
217
224
226
227 // ----------------------- Accessor services ------------------------------
228 public:
231
233 Size nbCells() const;
244
247 std::vector< Point > getKPoints( const Dimension k ) const;
248
250
251 // ----------------------- Cell services ------------------------------
252 public:
255
265 bool subset( const CellGeometry& other ) const;
266
276 bool subset( const CellGeometry& other, const Dimension k ) const;
277
279
280 // ----------------------- helper services ------------------------------
281 public:
284
291 std::vector< Point >
292 getIntersectedKPoints( const LatticePolytope& polytope, const Dimension i ) const;
293
300 std::vector< Point >
301 getIntersectedKPoints( const RationalPolytope& polytope, const Dimension i ) const;
302
308 std::vector< Point >
309 getTouchedKPoints( const std::vector< Point >& points, const Dimension i ) const;
310
311
318 std::vector< Cell >
319 getIntersectedCells( const LatticePolytope& polytope, const Dimension i ) const;
320
327 std::vector< Cell >
328 getIntersectedCells( const RationalPolytope& polytope, const Dimension i ) const;
329
335 std::vector< Cell >
336 getTouchedCells( const std::vector< Point >& points, const Dimension i ) const;
337
339
340 // ----------------------- Khalimsky point services -------------------------------
341 public:
344
348 static Dimension dim( const Point& kp );
349
351
352 // ----------------------- Interface --------------------------------------
353 public:
356
361 void selfDisplay ( std::ostream & out ) const;
362
368 bool isValid() const;
369
373 std::string className() const;
374
376
377 // ------------------------- Protected Datas ------------------------------
378 protected:
379
391
392 // ------------------------- Private Datas --------------------------------
393 private:
394
395
396 // ------------------------- Internals ------------------------------------
397 private:
398 // Internal method for cheking if sorted range [it1,itE1] is a
399 // subset of sorted range [it2, itE2]. Different from
400 // std::includes since it performs exponential march and dichotomy
401 // to walk faster along range [it1,itE1].
402 template <typename RandomIterator>
403 static
404 bool includes( RandomIterator it2, RandomIterator itE2,
405 RandomIterator it1, RandomIterator itE1 );
406
407 }; // end of class CellGeometry
408
411
418 template <typename TKSpace>
419 std::ostream&
420 operator<< ( std::ostream & out,
421 const CellGeometry<TKSpace> & object );
422
424
432 template <typename TKSpace, int i, int N>
434 {
436 typedef TKSpace KSpace;
437 typedef typename KSpace::Space Space;
438 typedef typename KSpace::Cell Cell;
439 typedef typename KSpace::Point Point;
440
447 template <typename PointelIterator>
448 static
449 std::unordered_set<typename KSpace::Cell>
451 PointelIterator itB, PointelIterator itE )
452 {
453 std::unordered_set<typename KSpace::Cell> cells;
454 if ( i == 0 )
455 for ( auto it = itB; it != itE; ++it )
456 cells.insert( *it );
457 else
458 for ( auto it = itB; it != itE; ++it )
459 {
460 auto pointel = *it;
461 auto cofaces = K.uCoFaces( pointel );
462 for ( auto&& f : cofaces )
463 if ( K.uDim( f ) == i ) cells.insert( f );
464 }
465 return cells;
466 }
467
474 template <typename PointIterator>
475 static
476 std::unordered_set<typename KSpace::Cell>
478 PointIterator itB, PointIterator itE )
479 {
480 std::unordered_set<typename KSpace::Cell> cells;
481 if ( i == 0 )
482 for ( auto it = itB; it != itE; ++it )
483 cells.insert( K.uPointel( *it ) );
484 else
485 for ( auto it = itB; it != itE; ++it )
486 {
487 auto pointel = K.uPointel( *it );
488 auto cofaces = K.uCoFaces( pointel );
489 for ( auto&& f : cofaces )
490 if ( K.uDim( f ) == i ) cells.insert( f );
491 }
492 return cells;
493 }
494
501 template <typename PointIterator>
502 static
506 PointIterator itB, PointIterator itE )
507 {
510 if ( i == 0 )
511 for ( auto it = itB; it != itE; ++it )
512 kpoints.insert( K.uKCoords( K.uPointel( *it ) ) );
513 else
514 for ( auto it = itB; it != itE; ++it )
515 {
516 auto pointel = K.uPointel( *it );
517 auto cofaces = K.uCoFaces( pointel );
518 for ( auto&& f : cofaces )
519 if ( K.uDim( f ) == i ) kpoints.insert( K.uKCoords( f ) );
520 }
521 return kpoints;
522 }
523
524
525 }; // end struct CellGeometryFunctions
526
529 template <typename TKSpace>
530 struct CellGeometryFunctions< TKSpace, 1, 2 >
531 {
533 BOOST_STATIC_ASSERT( TKSpace::dimension == 2 );
534 typedef TKSpace KSpace;
535 typedef typename KSpace::Space Space;
536 typedef typename KSpace::Cell Cell;
537
543 template <typename PointelIterator>
544 static
545 std::unordered_set<typename KSpace::Cell>
547 PointelIterator itB, PointelIterator itE )
548 {
549 std::unordered_set<typename KSpace::Cell> cells;
550 for ( auto it = itB; it != itE; ++it )
551 {
552 auto pointel = *it;
553 cells.insert( K.uIncident( pointel, 0, true ) );
554 cells.insert( K.uIncident( pointel, 0, false ) );
555 cells.insert( K.uIncident( pointel, 1, true ) );
556 cells.insert( K.uIncident( pointel, 1, false ) );
557 }
558 return cells;
559 }
560
566 template <typename PointIterator>
567 static
568 std::unordered_set<typename KSpace::Cell>
570 PointIterator itB, PointIterator itE )
571 {
572 std::unordered_set<typename KSpace::Cell> cells;
573 for ( auto it = itB; it != itE; ++it )
574 {
575 auto pointel = K.uPointel( *it );
576 cells.insert( K.uIncident( pointel, 0, true ) );
577 cells.insert( K.uIncident( pointel, 0, false ) );
578 cells.insert( K.uIncident( pointel, 1, true ) );
579 cells.insert( K.uIncident( pointel, 1, false ) );
580 }
581 return cells;
582 }
583
589 template <typename PointIterator>
590 static
594 PointIterator itB, PointIterator itE )
595 {
598 for ( auto it = itB; it != itE; ++it )
599 {
600 auto kp = K.uKCoords( K.uPointel( *it ) );
601 kpoints.emplace( kp[ 0 ] , kp[ 1 ] - 1 );
602 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] );
603 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] );
604 kpoints.emplace( kp[ 0 ] , kp[ 1 ] + 1 );
605 }
606 return kpoints;
607 }
608
609 }; // end struct CellGeometryFunctions
610
613 template <typename TKSpace>
614 struct CellGeometryFunctions< TKSpace, 1, 3 >
615 {
617 BOOST_STATIC_ASSERT( TKSpace::dimension == 3 );
618 typedef TKSpace KSpace;
619 typedef typename KSpace::Space Space;
620 typedef typename KSpace::Cell Cell;
621
627 template <typename PointelIterator>
628 static
629 std::unordered_set<typename KSpace::Cell>
631 PointelIterator itB, PointelIterator itE )
632 {
633 std::unordered_set<typename KSpace::Cell> cells;
634 for ( auto it = itB; it != itE; ++it )
635 {
636 auto pointel = *it;
637 cells.insert( K.uIncident( pointel, 0, true ) );
638 cells.insert( K.uIncident( pointel, 0, false ) );
639 cells.insert( K.uIncident( pointel, 1, true ) );
640 cells.insert( K.uIncident( pointel, 1, false ) );
641 cells.insert( K.uIncident( pointel, 2, true ) );
642 cells.insert( K.uIncident( pointel, 2, false ) );
643 }
644 return cells;
645 }
646
653 template <typename PointIterator>
654 static
655 std::unordered_set<typename KSpace::Cell>
657 PointIterator itB, PointIterator itE )
658 {
659 std::cout << "<1,3> specialization" << std::endl;
660 std::unordered_set<typename KSpace::Cell> cells;
661 for ( auto it = itB; it != itE; ++it )
662 {
663 auto pointel = K.uPointel( *it );
664 cells.insert( K.uIncident( pointel, 0, true ) );
665 cells.insert( K.uIncident( pointel, 0, false ) );
666 cells.insert( K.uIncident( pointel, 1, true ) );
667 cells.insert( K.uIncident( pointel, 1, false ) );
668 cells.insert( K.uIncident( pointel, 2, true ) );
669 cells.insert( K.uIncident( pointel, 2, false ) );
670 }
671 return cells;
672 }
673
679 template <typename PointIterator>
680 static
684 PointIterator itB, PointIterator itE )
685 {
688 for ( auto it = itB; it != itE; ++it )
689 {
690 auto kp = K.uKCoords( K.uPointel( *it ) );
691 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] , kp[ 2 ] );
692 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] , kp[ 2 ] );
693 kpoints.emplace( kp[ 0 ] , kp[ 1 ] - 1, kp[ 2 ] );
694 kpoints.emplace( kp[ 0 ] , kp[ 1 ] + 1, kp[ 2 ] );
695 kpoints.emplace( kp[ 0 ] , kp[ 1 ] , kp[ 2 ] - 1 );
696 kpoints.emplace( kp[ 0 ] , kp[ 1 ] , kp[ 2 ] + 1 );
697 }
698 return kpoints;
699 }
700
701 }; // end struct CellGeometryFunctions
702
705 template <typename TKSpace>
706 struct CellGeometryFunctions< TKSpace, 2, 2 >
707 {
709 BOOST_STATIC_ASSERT( TKSpace::dimension == 2 );
710 typedef TKSpace KSpace;
711 typedef typename KSpace::Space Space;
712 typedef typename KSpace::Cell Cell;
713
719 template <typename PointelIterator>
720 static
721 std::unordered_set<typename KSpace::Cell>
723 PointelIterator itB, PointelIterator itE )
724 {
725 std::unordered_set<typename KSpace::Cell> cells;
726 for ( auto it = itB; it != itE; ++it )
727 {
728 auto pointel = *it;
729 auto linelxp = K.uIncident( pointel, 0, true );
730 auto linelxm = K.uIncident( pointel, 0, false );
731 cells.insert( K.uIncident( linelxp, 1, true ) );
732 cells.insert( K.uIncident( linelxp, 1, false ) );
733 cells.insert( K.uIncident( linelxm, 1, true ) );
734 cells.insert( K.uIncident( linelxm, 1, false ) );
735 }
736 return cells;
737 }
738
745 template <typename PointIterator>
746 static
747 std::unordered_set<typename KSpace::Cell>
749 PointIterator itB, PointIterator itE )
750 {
751 std::cout << "<2,2> specialization" << std::endl;
752 std::unordered_set<typename KSpace::Cell> cells;
753 for ( auto it = itB; it != itE; ++it )
754 {
755 auto pointel = K.uPointel( *it );
756 auto linelxp = K.uIncident( pointel, 0, true );
757 auto linelxm = K.uIncident( pointel, 0, false );
758 cells.insert( K.uIncident( linelxp, 1, true ) );
759 cells.insert( K.uIncident( linelxp, 1, false ) );
760 cells.insert( K.uIncident( linelxm, 1, true ) );
761 cells.insert( K.uIncident( linelxm, 1, false ) );
762 }
763 return cells;
764 }
765
771 template <typename PointIterator>
772 static
776 PointIterator itB, PointIterator itE )
777 {
780 for ( auto it = itB; it != itE; ++it )
781 {
782 auto kp = K.uKCoords( K.uPointel( *it ) );
783 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] - 1 );
784 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] - 1 );
785 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] + 1 );
786 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] + 1 );
787 }
788 return kpoints;
789 }
790
791 }; // end struct CellGeometryFunctions
792
795 template <typename TKSpace>
796 struct CellGeometryFunctions< TKSpace, 2, 3 >
797 {
799 BOOST_STATIC_ASSERT( TKSpace::dimension == 2 );
800 typedef TKSpace KSpace;
801 typedef typename KSpace::Space Space;
802 typedef typename KSpace::Cell Cell;
803
809 template <typename PointelIterator>
810 static
811 std::unordered_set<typename KSpace::Cell>
813 PointelIterator itB, PointelIterator itE )
814 {
815 std::unordered_set<typename KSpace::Cell> cells;
816 for ( auto it = itB; it != itE; ++it )
817 {
818 auto pointel = *it;
819 auto linelxp = K.uIncident( pointel, 0, true );
820 auto linelxm = K.uIncident( pointel, 0, false );
821 auto linelyp = K.uIncident( pointel, 1, true );
822 auto linelym = K.uIncident( pointel, 1, false );
823 cells.insert( K.uIncident( linelxp, 1, true ) );
824 cells.insert( K.uIncident( linelxp, 1, false ) );
825 cells.insert( K.uIncident( linelxp, 2, true ) );
826 cells.insert( K.uIncident( linelxp, 2, false ) );
827 cells.insert( K.uIncident( linelxm, 1, true ) );
828 cells.insert( K.uIncident( linelxm, 1, false ) );
829 cells.insert( K.uIncident( linelxm, 2, true ) );
830 cells.insert( K.uIncident( linelxm, 2, false ) );
831 cells.insert( K.uIncident( linelyp, 2, true ) );
832 cells.insert( K.uIncident( linelyp, 2, false ) );
833 cells.insert( K.uIncident( linelym, 2, true ) );
834 cells.insert( K.uIncident( linelym, 2, false ) );
835 }
836 return cells;
837 }
838
845 template <typename PointIterator>
846 static
847 std::unordered_set<typename KSpace::Cell>
849 PointIterator itB, PointIterator itE )
850 {
851 std::cout << "<2,3> specialization" << std::endl;
852 std::unordered_set<typename KSpace::Cell> cells;
853 for ( auto it = itB; it != itE; ++it )
854 {
855 auto pointel = K.uPointel( *it );
856 auto linelxp = K.uIncident( pointel, 0, true );
857 auto linelxm = K.uIncident( pointel, 0, false );
858 auto linelyp = K.uIncident( pointel, 1, true );
859 auto linelym = K.uIncident( pointel, 1, false );
860 cells.insert( K.uIncident( linelxp, 1, true ) );
861 cells.insert( K.uIncident( linelxp, 1, false ) );
862 cells.insert( K.uIncident( linelxp, 2, true ) );
863 cells.insert( K.uIncident( linelxp, 2, false ) );
864 cells.insert( K.uIncident( linelxm, 1, true ) );
865 cells.insert( K.uIncident( linelxm, 1, false ) );
866 cells.insert( K.uIncident( linelxm, 2, true ) );
867 cells.insert( K.uIncident( linelxm, 2, false ) );
868 cells.insert( K.uIncident( linelyp, 2, true ) );
869 cells.insert( K.uIncident( linelyp, 2, false ) );
870 cells.insert( K.uIncident( linelym, 2, true ) );
871 cells.insert( K.uIncident( linelym, 2, false ) );
872 }
873 return cells;
874 }
875
881 template <typename PointIterator>
882 static
886 PointIterator itB, PointIterator itE )
887 {
890 for ( auto it = itB; it != itE; ++it )
891 {
892 auto kp = K.uKCoords( K.uPointel( *it ) );
893 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] - 1, kp[ 2 ] );
894 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] - 1, kp[ 2 ] );
895 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] + 1, kp[ 2 ] );
896 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] + 1, kp[ 2 ] );
897 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] , kp[ 2 ] - 1 );
898 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] , kp[ 2 ] - 1 );
899 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] , kp[ 2 ] + 1 );
900 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] , kp[ 2 ] + 1 );
901 kpoints.emplace( kp[ 0 ] , kp[ 1 ] - 1, kp[ 2 ] - 1 );
902 kpoints.emplace( kp[ 0 ] , kp[ 1 ] + 1, kp[ 2 ] - 1 );
903 kpoints.emplace( kp[ 0 ] , kp[ 1 ] - 1, kp[ 2 ] + 1 );
904 kpoints.emplace( kp[ 0 ] , kp[ 1 ] + 1, kp[ 2 ] + 1 );
905 }
906 return kpoints;
907 }
908
909 }; // end struct CellGeometryFunctions
910
913 template <typename TKSpace>
914 struct CellGeometryFunctions< TKSpace, 3, 3 >
915 {
917 BOOST_STATIC_ASSERT( TKSpace::dimension == 3 );
918 typedef TKSpace KSpace;
919 typedef typename KSpace::Space Space;
920 typedef typename KSpace::Cell Cell;
921
927 template <typename PointelIterator>
928 static
929 std::unordered_set<typename KSpace::Cell>
931 PointelIterator itB, PointelIterator itE )
932 {
933 std::unordered_set<typename KSpace::Cell> cells;
934 for ( auto it = itB; it != itE; ++it )
935 {
936 auto pointel = *it;
937 auto linelxp = K.uIncident( pointel, 0, true );
938 auto linelxm = K.uIncident( pointel, 0, false );
939 auto surfxpyp = K.uIncident( linelxp, 1, true );
940 auto surfxpym = K.uIncident( linelxp, 1, false );
941 auto surfxmyp = K.uIncident( linelxm, 1, true );
942 auto surfxmym = K.uIncident( linelxm, 1, false );
943 cells.insert( K.uIncident( surfxpyp, 2, true ) );
944 cells.insert( K.uIncident( surfxpyp, 2, false ) );
945 cells.insert( K.uIncident( surfxpym, 2, true ) );
946 cells.insert( K.uIncident( surfxpym, 2, false ) );
947 cells.insert( K.uIncident( surfxmyp, 2, true ) );
948 cells.insert( K.uIncident( surfxmyp, 2, false ) );
949 cells.insert( K.uIncident( surfxmym, 2, true ) );
950 cells.insert( K.uIncident( surfxmym, 2, false ) );
951 }
952 return cells;
953 }
954
961 template <typename PointIterator>
962 static
963 std::unordered_set<typename KSpace::Cell>
965 PointIterator itB, PointIterator itE )
966 {
967 std::unordered_set<typename KSpace::Cell> cells;
968 for ( auto it = itB; it != itE; ++it )
969 {
970 auto pointel = K.uPointel( *it );
971 auto linelxp = K.uIncident( pointel, 0, true );
972 auto linelxm = K.uIncident( pointel, 0, false );
973 auto surfxpyp = K.uIncident( linelxp, 1, true );
974 auto surfxpym = K.uIncident( linelxp, 1, false );
975 auto surfxmyp = K.uIncident( linelxm, 1, true );
976 auto surfxmym = K.uIncident( linelxm, 1, false );
977 cells.insert( K.uIncident( surfxpyp, 2, true ) );
978 cells.insert( K.uIncident( surfxpyp, 2, false ) );
979 cells.insert( K.uIncident( surfxpym, 2, true ) );
980 cells.insert( K.uIncident( surfxpym, 2, false ) );
981 cells.insert( K.uIncident( surfxmyp, 2, true ) );
982 cells.insert( K.uIncident( surfxmyp, 2, false ) );
983 cells.insert( K.uIncident( surfxmym, 2, true ) );
984 cells.insert( K.uIncident( surfxmym, 2, false ) );
985 }
986 return cells;
987 }
988
994 template <typename PointIterator>
995 static
999 PointIterator itB, PointIterator itE )
1000 {
1003 for ( auto it = itB; it != itE; ++it )
1004 {
1005 auto kp = K.uKCoords( K.uPointel( *it ) );
1006 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] - 1, kp[ 2 ] - 1 );
1007 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] - 1, kp[ 2 ] - 1 );
1008 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] + 1, kp[ 2 ] - 1 );
1009 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] + 1, kp[ 2 ] - 1 );
1010 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] - 1, kp[ 2 ] + 1 );
1011 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] - 1, kp[ 2 ] + 1 );
1012 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] + 1, kp[ 2 ] + 1 );
1013 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] + 1, kp[ 2 ] + 1 );
1014 }
1015 return kpoints;
1016 }
1017
1018 }; // end struct CellGeometryFunctions
1019
1020
1021} // namespace DGtal
1022
1023
1025// Includes inline functions.
1026#include "CellGeometry.ih"
1027
1028// //
1030
1031#endif // !defined CellGeometry_h
1032
1033#undef CellGeometry_RECURSES
1034#endif // else defined(CellGeometry_RECURSES)
Aim: Represents an nD lattice polytope, i.e. a convex polyhedron bounded with vertices with integer c...
Aim: Represents an nD rational polytope, i.e. a convex polyhedron bounded by vertices with rational c...
Aim: Computes and stores sets of cells and provides methods to compute intersections of lattice and r...
~CellGeometry()=default
static const Dimension dimension
Self & operator=(const Self &other)=default
UnorderedSetByBlock< Point, Splitter< Point, uint64_t > > myKPoints
The unordered set that stores cells.
CellGeometry & operator+=(const CellGeometry &other)
bool isValid() const
static bool includes(RandomIterator it2, RandomIterator itE2, RandomIterator it1, RandomIterator itE1)
bool subset(const CellGeometry &other) const
static Dimension dim(const Point &kp)
void addCellsTouchingPolytopePoints(const RationalPolytope &polytope)
KSpace::Vector Vector
Dimension maxCellDim() const
std::vector< Cell > getTouchedCells(const std::vector< Point > &points, const Dimension i) const
Dimension myMinCellDim
The minimum cell dimension.
CellGeometry(const KSpace &K, Dimension min_cell_dim=0, Dimension max_cell_dim=KSpace::dimension, bool verbose=false)
KSpace::Space Space
KSpace::Integer Integer
std::vector< Point > getKPoints(const Dimension k) const
void addCellsTouchingPointels(PointelIterator itB, PointelIterator itE)
CellGeometry(Self &&other)=default
void init(const KSpace &K, Dimension min_cell_dim=0, Dimension max_cell_dim=KSpace::dimension, bool verbose=false)
std::vector< Point > getTouchedKPoints(const std::vector< Point > &points, const Dimension i) const
void addCellsTouchingPoints(PointIterator itB, PointIterator itE)
CellGeometry(const Self &other)=default
std::vector< Cell > getIntersectedCells(const LatticePolytope &polytope, const Dimension i) const
bool subset(const CellGeometry &other, const Dimension k) const
std::string className() const
Dimension minCellDim() const
KSpace::Size Size
DGtal::BigInteger BigInteger
DGtal::BoundedLatticePolytope< Space > Polytope
DGtal::BoundedLatticePolytope< Space > LatticePolytope
void addCellsTouchingPoint(const Point &p)
std::vector< Cell > getIntersectedCells(const RationalPolytope &polytope, const Dimension i) const
void addCellsTouchingPolytope(const LatticePolytope &polytope)
CellGeometry< TKSpace > Self
void addCellsTouchingPolytope(const RationalPolytope &polytope)
std::vector< Point > getIntersectedKPoints(const RationalPolytope &polytope, const Dimension i) const
bool myVerbose
Tells if verbose mode.
KSpace::Point Point
KSpace myK
The cellular space for cells.
DGtal::BoundedRationalPolytope< Space > RationalPolytope
std::vector< Point > getIntersectedKPoints(const LatticePolytope &polytope, const Dimension i) const
KSpace::Cell Cell
Size computeNbCells(const Dimension k) const
Dimension myMaxCellDim
The maximal cell dimension.
void addCellsTouchingPointel(const Cell &pointel)
void addCellsTouchingSegment(const Point &a, const Point &b)
void addCellsTouchingPolytopePoints(const LatticePolytope &polytope)
void addCellsTouchingCell(const Cell &c)
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
Size nbCells() const
Integer computeEuler() const
void selfDisplay(std::ostream &out) const
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
PointVector< dim, Integer > Point
NumberTraits< Integer >::UnsignedVersion Size
Type used to represent sizes in the digital space.
static const constexpr Dimension dimension
DGtal is the top-level namespace which contains all DGtal functions and types.
boost::int64_t int64_t
signed 94-bit integer.
Definition BasicTypes.h:74
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::uint32_t Dimension
Definition Common.h:136
mpz_class BigInteger
Multi-precision integer with GMP implementation.
Definition BasicTypes.h:79
static UnorderedSetByBlock< typename KSpace::Point, Splitter< typename KSpace::Point, uint64_t > > getIncidentKPointsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPointels(const KSpace &K, PointelIterator itB, PointelIterator itE)
static UnorderedSetByBlock< typename KSpace::Point, Splitter< typename KSpace::Point, uint64_t > > getIncidentKPointsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPointels(const KSpace &K, PointelIterator itB, PointelIterator itE)
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
static UnorderedSetByBlock< typename KSpace::Point, Splitter< typename KSpace::Point, uint64_t > > getIncidentKPointsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPointels(const KSpace &K, PointelIterator itB, PointelIterator itE)
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPointels(const KSpace &K, PointelIterator itB, PointelIterator itE)
static UnorderedSetByBlock< typename KSpace::Point, Splitter< typename KSpace::Point, uint64_t > > getIncidentKPointsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPointels(const KSpace &K, PointelIterator itB, PointelIterator itE)
static UnorderedSetByBlock< typename KSpace::Point, Splitter< typename KSpace::Point, uint64_t > > getIncidentKPointsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPointels(const KSpace &K, PointelIterator itB, PointelIterator itE)
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
static UnorderedSetByBlock< typename KSpace::Point, Splitter< typename KSpace::Point, uint64_t > > getIncidentKPointsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
Aim: This concept describes a cellular grid space in nD. In these spaces obtained by cartesian produc...
KSpace K