Loading [MathJax]/extensions/TeX/AMSsymbols.js
DGtal 2.0.0
CellGeometry.h
1
16
17#pragma once
18
30
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;
91
93
94
97
101 ~CellGeometry() = default;
102
107
112 CellGeometry ( const Self & other ) = default;
113
118 CellGeometry ( Self && other ) = default;
119
128 Dimension min_cell_dim = 0,
129 Dimension max_cell_dim = KSpace::dimension,
130 bool verbose = false );
131
137 Self & operator= ( const Self & other ) = default;
138
146 void init( const KSpace & K,
147 Dimension min_cell_dim = 0,
148 Dimension max_cell_dim = KSpace::dimension,
149 bool verbose = false );
151
152 // ----------------------- Cells services ------------------------------
153 public:
156
159 void addCellsTouchingPoint( const Point& p );
160
163 void addCellsTouchingPointel( const Cell& pointel );
164
169 void addCellsTouchingCell( const Cell& c );
170
180 void addCellsTouchingSegment( const Point& a, const Point& b );
181
184 template <typename PointIterator>
185 void addCellsTouchingPoints( PointIterator itB, PointIterator itE );
186
189 template <typename PointelIterator>
190 void addCellsTouchingPointels( PointelIterator itB, PointelIterator itE );
191
196
201
207
213
220
222
223 // ----------------------- Accessor services ------------------------------
224 public:
227
229 Size nbCells() const;
240
243 std::vector< Point > getKPoints( const Dimension k ) const;
244
246
247 // ----------------------- Cell services ------------------------------
248 public:
251
261 bool subset( const CellGeometry& other ) const;
262
272 bool subset( const CellGeometry& other, const Dimension k ) const;
273
275
276 // ----------------------- helper services ------------------------------
277 public:
280
287 std::vector< Point >
288 getIntersectedKPoints( const LatticePolytope& polytope, const Dimension i ) const;
289
296 std::vector< Point >
297 getIntersectedKPoints( const RationalPolytope& polytope, const Dimension i ) const;
298
304 std::vector< Point >
305 getTouchedKPoints( const std::vector< Point >& points, const Dimension i ) const;
306
307
314 std::vector< Cell >
315 getIntersectedCells( const LatticePolytope& polytope, const Dimension i ) const;
316
323 std::vector< Cell >
324 getIntersectedCells( const RationalPolytope& polytope, const Dimension i ) const;
325
331 std::vector< Cell >
332 getTouchedCells( const std::vector< Point >& points, const Dimension i ) const;
333
335
336 // ----------------------- Khalimsky point services -------------------------------
337 public:
340
344 static Dimension dim( const Point& kp );
345
347
348 // ----------------------- Interface --------------------------------------
349 public:
352
357 void selfDisplay ( std::ostream & out ) const;
358
364 bool isValid() const;
365
369 std::string className() const;
370
372
373 // ------------------------- Protected Datas ------------------------------
374 protected:
375
387
388 // ------------------------- Private Datas --------------------------------
389 private:
390
391
392 // ------------------------- Internals ------------------------------------
393 private:
394 // Internal method for cheking if sorted range [it1,itE1] is a
395 // subset of sorted range [it2, itE2]. Different from
396 // std::includes since it performs exponential march and dichotomy
397 // to walk faster along range [it1,itE1].
398 template <typename RandomIterator>
399 static
400 bool includes( RandomIterator it2, RandomIterator itE2,
401 RandomIterator it1, RandomIterator itE1 );
402
403 }; // end of class CellGeometry
404
407
414 template <typename TKSpace>
415 std::ostream&
416 operator<< ( std::ostream & out,
417 const CellGeometry<TKSpace> & object );
418
420
428 template <typename TKSpace, int i, int N>
430 {
432 typedef TKSpace KSpace;
433 typedef typename KSpace::Space Space;
434 typedef typename KSpace::Cell Cell;
435 typedef typename KSpace::Point Point;
436
443 template <typename PointelIterator>
444 static
445 std::unordered_set<typename KSpace::Cell>
447 PointelIterator itB, PointelIterator itE )
448 {
449 std::unordered_set<typename KSpace::Cell> cells;
450 if ( i == 0 )
451 for ( auto it = itB; it != itE; ++it )
452 cells.insert( *it );
453 else
454 for ( auto it = itB; it != itE; ++it )
455 {
456 auto pointel = *it;
457 auto cofaces = K.uCoFaces( pointel );
458 for ( auto&& f : cofaces )
459 if ( K.uDim( f ) == i ) cells.insert( f );
460 }
461 return cells;
462 }
463
470 template <typename PointIterator>
471 static
472 std::unordered_set<typename KSpace::Cell>
474 PointIterator itB, PointIterator itE )
475 {
476 std::unordered_set<typename KSpace::Cell> cells;
477 if ( i == 0 )
478 for ( auto it = itB; it != itE; ++it )
479 cells.insert( K.uPointel( *it ) );
480 else
481 for ( auto it = itB; it != itE; ++it )
482 {
483 auto pointel = K.uPointel( *it );
484 auto cofaces = K.uCoFaces( pointel );
485 for ( auto&& f : cofaces )
486 if ( K.uDim( f ) == i ) cells.insert( f );
487 }
488 return cells;
489 }
490
497 template <typename PointIterator>
498 static
502 PointIterator itB, PointIterator itE )
503 {
506 if ( i == 0 )
507 for ( auto it = itB; it != itE; ++it )
508 kpoints.insert( K.uKCoords( K.uPointel( *it ) ) );
509 else
510 for ( auto it = itB; it != itE; ++it )
511 {
512 auto pointel = K.uPointel( *it );
513 auto cofaces = K.uCoFaces( pointel );
514 for ( auto&& f : cofaces )
515 if ( K.uDim( f ) == i ) kpoints.insert( K.uKCoords( f ) );
516 }
517 return kpoints;
518 }
519
520
521 }; // end struct CellGeometryFunctions
522
525 template <typename TKSpace>
526 struct CellGeometryFunctions< TKSpace, 1, 2 >
527 {
529 BOOST_STATIC_ASSERT( TKSpace::dimension == 2 );
530 typedef TKSpace KSpace;
531 typedef typename KSpace::Space Space;
532 typedef typename KSpace::Cell Cell;
533
539 template <typename PointelIterator>
540 static
541 std::unordered_set<typename KSpace::Cell>
543 PointelIterator itB, PointelIterator itE )
544 {
545 std::unordered_set<typename KSpace::Cell> cells;
546 for ( auto it = itB; it != itE; ++it )
547 {
548 auto pointel = *it;
549 cells.insert( K.uIncident( pointel, 0, true ) );
550 cells.insert( K.uIncident( pointel, 0, false ) );
551 cells.insert( K.uIncident( pointel, 1, true ) );
552 cells.insert( K.uIncident( pointel, 1, false ) );
553 }
554 return cells;
555 }
556
562 template <typename PointIterator>
563 static
564 std::unordered_set<typename KSpace::Cell>
566 PointIterator itB, PointIterator itE )
567 {
568 std::unordered_set<typename KSpace::Cell> cells;
569 for ( auto it = itB; it != itE; ++it )
570 {
571 auto pointel = K.uPointel( *it );
572 cells.insert( K.uIncident( pointel, 0, true ) );
573 cells.insert( K.uIncident( pointel, 0, false ) );
574 cells.insert( K.uIncident( pointel, 1, true ) );
575 cells.insert( K.uIncident( pointel, 1, false ) );
576 }
577 return cells;
578 }
579
585 template <typename PointIterator>
586 static
590 PointIterator itB, PointIterator itE )
591 {
594 for ( auto it = itB; it != itE; ++it )
595 {
596 auto kp = K.uKCoords( K.uPointel( *it ) );
597 kpoints.emplace( kp[ 0 ] , kp[ 1 ] - 1 );
598 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] );
599 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] );
600 kpoints.emplace( kp[ 0 ] , kp[ 1 ] + 1 );
601 }
602 return kpoints;
603 }
604
605 }; // end struct CellGeometryFunctions
606
609 template <typename TKSpace>
610 struct CellGeometryFunctions< TKSpace, 1, 3 >
611 {
613 BOOST_STATIC_ASSERT( TKSpace::dimension == 3 );
614 typedef TKSpace KSpace;
615 typedef typename KSpace::Space Space;
616 typedef typename KSpace::Cell Cell;
617
623 template <typename PointelIterator>
624 static
625 std::unordered_set<typename KSpace::Cell>
627 PointelIterator itB, PointelIterator itE )
628 {
629 std::unordered_set<typename KSpace::Cell> cells;
630 for ( auto it = itB; it != itE; ++it )
631 {
632 auto pointel = *it;
633 cells.insert( K.uIncident( pointel, 0, true ) );
634 cells.insert( K.uIncident( pointel, 0, false ) );
635 cells.insert( K.uIncident( pointel, 1, true ) );
636 cells.insert( K.uIncident( pointel, 1, false ) );
637 cells.insert( K.uIncident( pointel, 2, true ) );
638 cells.insert( K.uIncident( pointel, 2, false ) );
639 }
640 return cells;
641 }
642
649 template <typename PointIterator>
650 static
651 std::unordered_set<typename KSpace::Cell>
653 PointIterator itB, PointIterator itE )
654 {
655 std::cout << "<1,3> specialization" << std::endl;
656 std::unordered_set<typename KSpace::Cell> cells;
657 for ( auto it = itB; it != itE; ++it )
658 {
659 auto pointel = K.uPointel( *it );
660 cells.insert( K.uIncident( pointel, 0, true ) );
661 cells.insert( K.uIncident( pointel, 0, false ) );
662 cells.insert( K.uIncident( pointel, 1, true ) );
663 cells.insert( K.uIncident( pointel, 1, false ) );
664 cells.insert( K.uIncident( pointel, 2, true ) );
665 cells.insert( K.uIncident( pointel, 2, false ) );
666 }
667 return cells;
668 }
669
675 template <typename PointIterator>
676 static
680 PointIterator itB, PointIterator itE )
681 {
684 for ( auto it = itB; it != itE; ++it )
685 {
686 auto kp = K.uKCoords( K.uPointel( *it ) );
687 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] , kp[ 2 ] );
688 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] , kp[ 2 ] );
689 kpoints.emplace( kp[ 0 ] , kp[ 1 ] - 1, kp[ 2 ] );
690 kpoints.emplace( kp[ 0 ] , kp[ 1 ] + 1, kp[ 2 ] );
691 kpoints.emplace( kp[ 0 ] , kp[ 1 ] , kp[ 2 ] - 1 );
692 kpoints.emplace( kp[ 0 ] , kp[ 1 ] , kp[ 2 ] + 1 );
693 }
694 return kpoints;
695 }
696
697 }; // end struct CellGeometryFunctions
698
701 template <typename TKSpace>
702 struct CellGeometryFunctions< TKSpace, 2, 2 >
703 {
705 BOOST_STATIC_ASSERT( TKSpace::dimension == 2 );
706 typedef TKSpace KSpace;
707 typedef typename KSpace::Space Space;
708 typedef typename KSpace::Cell Cell;
709
715 template <typename PointelIterator>
716 static
717 std::unordered_set<typename KSpace::Cell>
719 PointelIterator itB, PointelIterator itE )
720 {
721 std::unordered_set<typename KSpace::Cell> cells;
722 for ( auto it = itB; it != itE; ++it )
723 {
724 auto pointel = *it;
725 auto linelxp = K.uIncident( pointel, 0, true );
726 auto linelxm = K.uIncident( pointel, 0, false );
727 cells.insert( K.uIncident( linelxp, 1, true ) );
728 cells.insert( K.uIncident( linelxp, 1, false ) );
729 cells.insert( K.uIncident( linelxm, 1, true ) );
730 cells.insert( K.uIncident( linelxm, 1, false ) );
731 }
732 return cells;
733 }
734
741 template <typename PointIterator>
742 static
743 std::unordered_set<typename KSpace::Cell>
745 PointIterator itB, PointIterator itE )
746 {
747 std::cout << "<2,2> specialization" << std::endl;
748 std::unordered_set<typename KSpace::Cell> cells;
749 for ( auto it = itB; it != itE; ++it )
750 {
751 auto pointel = K.uPointel( *it );
752 auto linelxp = K.uIncident( pointel, 0, true );
753 auto linelxm = K.uIncident( pointel, 0, false );
754 cells.insert( K.uIncident( linelxp, 1, true ) );
755 cells.insert( K.uIncident( linelxp, 1, false ) );
756 cells.insert( K.uIncident( linelxm, 1, true ) );
757 cells.insert( K.uIncident( linelxm, 1, false ) );
758 }
759 return cells;
760 }
761
767 template <typename PointIterator>
768 static
772 PointIterator itB, PointIterator itE )
773 {
776 for ( auto it = itB; it != itE; ++it )
777 {
778 auto kp = K.uKCoords( K.uPointel( *it ) );
779 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] - 1 );
780 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] - 1 );
781 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] + 1 );
782 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] + 1 );
783 }
784 return kpoints;
785 }
786
787 }; // end struct CellGeometryFunctions
788
791 template <typename TKSpace>
792 struct CellGeometryFunctions< TKSpace, 2, 3 >
793 {
795 BOOST_STATIC_ASSERT( TKSpace::dimension == 2 );
796 typedef TKSpace KSpace;
797 typedef typename KSpace::Space Space;
798 typedef typename KSpace::Cell Cell;
799
805 template <typename PointelIterator>
806 static
807 std::unordered_set<typename KSpace::Cell>
809 PointelIterator itB, PointelIterator itE )
810 {
811 std::unordered_set<typename KSpace::Cell> cells;
812 for ( auto it = itB; it != itE; ++it )
813 {
814 auto pointel = *it;
815 auto linelxp = K.uIncident( pointel, 0, true );
816 auto linelxm = K.uIncident( pointel, 0, false );
817 auto linelyp = K.uIncident( pointel, 1, true );
818 auto linelym = K.uIncident( pointel, 1, false );
819 cells.insert( K.uIncident( linelxp, 1, true ) );
820 cells.insert( K.uIncident( linelxp, 1, false ) );
821 cells.insert( K.uIncident( linelxp, 2, true ) );
822 cells.insert( K.uIncident( linelxp, 2, false ) );
823 cells.insert( K.uIncident( linelxm, 1, true ) );
824 cells.insert( K.uIncident( linelxm, 1, false ) );
825 cells.insert( K.uIncident( linelxm, 2, true ) );
826 cells.insert( K.uIncident( linelxm, 2, false ) );
827 cells.insert( K.uIncident( linelyp, 2, true ) );
828 cells.insert( K.uIncident( linelyp, 2, false ) );
829 cells.insert( K.uIncident( linelym, 2, true ) );
830 cells.insert( K.uIncident( linelym, 2, false ) );
831 }
832 return cells;
833 }
834
841 template <typename PointIterator>
842 static
843 std::unordered_set<typename KSpace::Cell>
845 PointIterator itB, PointIterator itE )
846 {
847 std::cout << "<2,3> specialization" << std::endl;
848 std::unordered_set<typename KSpace::Cell> cells;
849 for ( auto it = itB; it != itE; ++it )
850 {
851 auto pointel = K.uPointel( *it );
852 auto linelxp = K.uIncident( pointel, 0, true );
853 auto linelxm = K.uIncident( pointel, 0, false );
854 auto linelyp = K.uIncident( pointel, 1, true );
855 auto linelym = K.uIncident( pointel, 1, false );
856 cells.insert( K.uIncident( linelxp, 1, true ) );
857 cells.insert( K.uIncident( linelxp, 1, false ) );
858 cells.insert( K.uIncident( linelxp, 2, true ) );
859 cells.insert( K.uIncident( linelxp, 2, false ) );
860 cells.insert( K.uIncident( linelxm, 1, true ) );
861 cells.insert( K.uIncident( linelxm, 1, false ) );
862 cells.insert( K.uIncident( linelxm, 2, true ) );
863 cells.insert( K.uIncident( linelxm, 2, false ) );
864 cells.insert( K.uIncident( linelyp, 2, true ) );
865 cells.insert( K.uIncident( linelyp, 2, false ) );
866 cells.insert( K.uIncident( linelym, 2, true ) );
867 cells.insert( K.uIncident( linelym, 2, false ) );
868 }
869 return cells;
870 }
871
877 template <typename PointIterator>
878 static
882 PointIterator itB, PointIterator itE )
883 {
886 for ( auto it = itB; it != itE; ++it )
887 {
888 auto kp = K.uKCoords( K.uPointel( *it ) );
889 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] - 1, kp[ 2 ] );
890 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] - 1, kp[ 2 ] );
891 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] + 1, kp[ 2 ] );
892 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] + 1, kp[ 2 ] );
893 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] , kp[ 2 ] - 1 );
894 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] , kp[ 2 ] - 1 );
895 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] , kp[ 2 ] + 1 );
896 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] , kp[ 2 ] + 1 );
897 kpoints.emplace( kp[ 0 ] , kp[ 1 ] - 1, kp[ 2 ] - 1 );
898 kpoints.emplace( kp[ 0 ] , kp[ 1 ] + 1, kp[ 2 ] - 1 );
899 kpoints.emplace( kp[ 0 ] , kp[ 1 ] - 1, kp[ 2 ] + 1 );
900 kpoints.emplace( kp[ 0 ] , kp[ 1 ] + 1, kp[ 2 ] + 1 );
901 }
902 return kpoints;
903 }
904
905 }; // end struct CellGeometryFunctions
906
909 template <typename TKSpace>
910 struct CellGeometryFunctions< TKSpace, 3, 3 >
911 {
913 BOOST_STATIC_ASSERT( TKSpace::dimension == 3 );
914 typedef TKSpace KSpace;
915 typedef typename KSpace::Space Space;
916 typedef typename KSpace::Cell Cell;
917
923 template <typename PointelIterator>
924 static
925 std::unordered_set<typename KSpace::Cell>
927 PointelIterator itB, PointelIterator itE )
928 {
929 std::unordered_set<typename KSpace::Cell> cells;
930 for ( auto it = itB; it != itE; ++it )
931 {
932 auto pointel = *it;
933 auto linelxp = K.uIncident( pointel, 0, true );
934 auto linelxm = K.uIncident( pointel, 0, false );
935 auto surfxpyp = K.uIncident( linelxp, 1, true );
936 auto surfxpym = K.uIncident( linelxp, 1, false );
937 auto surfxmyp = K.uIncident( linelxm, 1, true );
938 auto surfxmym = K.uIncident( linelxm, 1, false );
939 cells.insert( K.uIncident( surfxpyp, 2, true ) );
940 cells.insert( K.uIncident( surfxpyp, 2, false ) );
941 cells.insert( K.uIncident( surfxpym, 2, true ) );
942 cells.insert( K.uIncident( surfxpym, 2, false ) );
943 cells.insert( K.uIncident( surfxmyp, 2, true ) );
944 cells.insert( K.uIncident( surfxmyp, 2, false ) );
945 cells.insert( K.uIncident( surfxmym, 2, true ) );
946 cells.insert( K.uIncident( surfxmym, 2, false ) );
947 }
948 return cells;
949 }
950
957 template <typename PointIterator>
958 static
959 std::unordered_set<typename KSpace::Cell>
961 PointIterator itB, PointIterator itE )
962 {
963 std::unordered_set<typename KSpace::Cell> cells;
964 for ( auto it = itB; it != itE; ++it )
965 {
966 auto pointel = K.uPointel( *it );
967 auto linelxp = K.uIncident( pointel, 0, true );
968 auto linelxm = K.uIncident( pointel, 0, false );
969 auto surfxpyp = K.uIncident( linelxp, 1, true );
970 auto surfxpym = K.uIncident( linelxp, 1, false );
971 auto surfxmyp = K.uIncident( linelxm, 1, true );
972 auto surfxmym = K.uIncident( linelxm, 1, false );
973 cells.insert( K.uIncident( surfxpyp, 2, true ) );
974 cells.insert( K.uIncident( surfxpyp, 2, false ) );
975 cells.insert( K.uIncident( surfxpym, 2, true ) );
976 cells.insert( K.uIncident( surfxpym, 2, false ) );
977 cells.insert( K.uIncident( surfxmyp, 2, true ) );
978 cells.insert( K.uIncident( surfxmyp, 2, false ) );
979 cells.insert( K.uIncident( surfxmym, 2, true ) );
980 cells.insert( K.uIncident( surfxmym, 2, false ) );
981 }
982 return cells;
983 }
984
990 template <typename PointIterator>
991 static
995 PointIterator itB, PointIterator itE )
996 {
999 for ( auto it = itB; it != itE; ++it )
1000 {
1001 auto kp = K.uKCoords( K.uPointel( *it ) );
1002 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] - 1, kp[ 2 ] - 1 );
1003 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] - 1, kp[ 2 ] - 1 );
1004 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] + 1, kp[ 2 ] - 1 );
1005 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] + 1, kp[ 2 ] - 1 );
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 }
1011 return kpoints;
1012 }
1013
1014 }; // end struct CellGeometryFunctions
1015
1016
1017} // namespace DGtal
1018
1019
1021// Includes inline functions.
1022#include "CellGeometry.ih"
1023
1024// //
1026
1027#endif // !defined CellGeometry_h
1028
1029#undef CellGeometry_RECURSES
1030#endif // else defined(CellGeometry_RECURSES)
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
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
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
KSpace::Point Point
DGtal::BoundedRationalPolytope< Space > RationalPolytope
std::vector< Point > getIntersectedKPoints(const LatticePolytope &polytope, const Dimension i) const
KSpace::Cell Cell
Size computeNbCells(const Dimension k) const
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
PointVector< dim, Integer > Point
NumberTraits< Integer >::UnsignedVersion Size
PointVector< dim, Integer > Vector
static const constexpr Dimension dimension
KhalimskyCell< dim, Integer > Cell
DGtal is the top-level namespace which contains all DGtal functions and types.
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::uint32_t Dimension
Definition Common.h:119
boost::multiprecision::number< boost::multiprecision::cpp_int_backend<>, boost::multiprecision::et_off > BigInteger
Definition BasicTypes.h:75
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