DGtal 2.1.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;
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
302 std::vector< Point >
303 getIntersectedKPoints( const RationalPolytope& polytope, const Dimension i ) const;
304
310 std::vector< Point >
311 getTouchedKPoints( const std::vector< Point >& points, const Dimension i ) const;
312
313
320 std::vector< Cell >
321 getIntersectedCells( const LatticePolytope& polytope, const Dimension i ) const;
322
335 std::vector< Cell >
336 getIntersectedCells( const RationalPolytope& polytope, const Dimension i ) const;
337
343 std::vector< Cell >
344 getTouchedCells( const std::vector< Point >& points, const Dimension i ) const;
345
347
348 // ----------------------- Khalimsky point services -------------------------------
349 public:
352
356 static Dimension dim( const Point& kp );
357
359
360 // ----------------------- Interface --------------------------------------
361 public:
364
369 void selfDisplay ( std::ostream & out ) const;
370
376 bool isValid() const;
377
381 std::string className() const;
382
384
385 // ------------------------- Protected Datas ------------------------------
386 protected:
387
399
400 // ------------------------- Private Datas --------------------------------
401 private:
402
403
404 // ------------------------- Internals ------------------------------------
405 private:
406 // Internal method for cheking if sorted range [it1,itE1] is a
407 // subset of sorted range [it2, itE2]. Different from
408 // std::includes since it performs exponential march and dichotomy
409 // to walk faster along range [it1,itE1].
410 template <typename RandomIterator>
411 static
412 bool includes( RandomIterator it2, RandomIterator itE2,
413 RandomIterator it1, RandomIterator itE1 );
414
415 }; // end of class CellGeometry
416
419
426 template <typename TKSpace>
427 std::ostream&
428 operator<< ( std::ostream & out,
429 const CellGeometry<TKSpace> & object );
430
432
440 template <typename TKSpace, int i, int N>
442 {
444 typedef TKSpace KSpace;
445 typedef typename KSpace::Space Space;
446 typedef typename KSpace::Cell Cell;
447 typedef typename KSpace::Point Point;
448
455 template <typename PointelIterator>
456 static
457 std::unordered_set<typename KSpace::Cell>
459 PointelIterator itB, PointelIterator itE )
460 {
461 std::unordered_set<typename KSpace::Cell> cells;
462 if ( i == 0 )
463 for ( auto it = itB; it != itE; ++it )
464 cells.insert( *it );
465 else
466 for ( auto it = itB; it != itE; ++it )
467 {
468 auto pointel = *it;
469 auto cofaces = K.uCoFaces( pointel );
470 for ( auto&& f : cofaces )
471 if ( K.uDim( f ) == i ) cells.insert( f );
472 }
473 return cells;
474 }
475
482 template <typename PointIterator>
483 static
484 std::unordered_set<typename KSpace::Cell>
486 PointIterator itB, PointIterator itE )
487 {
488 std::unordered_set<typename KSpace::Cell> cells;
489 if ( i == 0 )
490 for ( auto it = itB; it != itE; ++it )
491 cells.insert( K.uPointel( *it ) );
492 else
493 for ( auto it = itB; it != itE; ++it )
494 {
495 auto pointel = K.uPointel( *it );
496 auto cofaces = K.uCoFaces( pointel );
497 for ( auto&& f : cofaces )
498 if ( K.uDim( f ) == i ) cells.insert( f );
499 }
500 return cells;
501 }
502
509 template <typename PointIterator>
510 static
514 PointIterator itB, PointIterator itE )
515 {
518 if ( i == 0 )
519 for ( auto it = itB; it != itE; ++it )
520 kpoints.insert( K.uKCoords( K.uPointel( *it ) ) );
521 else
522 for ( auto it = itB; it != itE; ++it )
523 {
524 auto pointel = K.uPointel( *it );
525 auto cofaces = K.uCoFaces( pointel );
526 for ( auto&& f : cofaces )
527 if ( K.uDim( f ) == i ) kpoints.insert( K.uKCoords( f ) );
528 }
529 return kpoints;
530 }
531
532
533 }; // end struct CellGeometryFunctions
534
537 template <typename TKSpace>
538 struct CellGeometryFunctions< TKSpace, 1, 2 >
539 {
541 BOOST_STATIC_ASSERT( TKSpace::dimension == 2 );
542 typedef TKSpace KSpace;
543 typedef typename KSpace::Space Space;
544 typedef typename KSpace::Cell Cell;
545
551 template <typename PointelIterator>
552 static
553 std::unordered_set<typename KSpace::Cell>
555 PointelIterator itB, PointelIterator itE )
556 {
557 std::unordered_set<typename KSpace::Cell> cells;
558 for ( auto it = itB; it != itE; ++it )
559 {
560 auto pointel = *it;
561 cells.insert( K.uIncident( pointel, 0, true ) );
562 cells.insert( K.uIncident( pointel, 0, false ) );
563 cells.insert( K.uIncident( pointel, 1, true ) );
564 cells.insert( K.uIncident( pointel, 1, false ) );
565 }
566 return cells;
567 }
568
574 template <typename PointIterator>
575 static
576 std::unordered_set<typename KSpace::Cell>
578 PointIterator itB, PointIterator itE )
579 {
580 std::unordered_set<typename KSpace::Cell> cells;
581 for ( auto it = itB; it != itE; ++it )
582 {
583 auto pointel = K.uPointel( *it );
584 cells.insert( K.uIncident( pointel, 0, true ) );
585 cells.insert( K.uIncident( pointel, 0, false ) );
586 cells.insert( K.uIncident( pointel, 1, true ) );
587 cells.insert( K.uIncident( pointel, 1, false ) );
588 }
589 return cells;
590 }
591
597 template <typename PointIterator>
598 static
602 PointIterator itB, PointIterator itE )
603 {
606 for ( auto it = itB; it != itE; ++it )
607 {
608 auto kp = K.uKCoords( K.uPointel( *it ) );
609 kpoints.emplace( kp[ 0 ] , kp[ 1 ] - 1 );
610 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] );
611 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] );
612 kpoints.emplace( kp[ 0 ] , kp[ 1 ] + 1 );
613 }
614 return kpoints;
615 }
616
617 }; // end struct CellGeometryFunctions
618
621 template <typename TKSpace>
622 struct CellGeometryFunctions< TKSpace, 1, 3 >
623 {
625 BOOST_STATIC_ASSERT( TKSpace::dimension == 3 );
626 typedef TKSpace KSpace;
627 typedef typename KSpace::Space Space;
628 typedef typename KSpace::Cell Cell;
629
635 template <typename PointelIterator>
636 static
637 std::unordered_set<typename KSpace::Cell>
639 PointelIterator itB, PointelIterator itE )
640 {
641 std::unordered_set<typename KSpace::Cell> cells;
642 for ( auto it = itB; it != itE; ++it )
643 {
644 auto pointel = *it;
645 cells.insert( K.uIncident( pointel, 0, true ) );
646 cells.insert( K.uIncident( pointel, 0, false ) );
647 cells.insert( K.uIncident( pointel, 1, true ) );
648 cells.insert( K.uIncident( pointel, 1, false ) );
649 cells.insert( K.uIncident( pointel, 2, true ) );
650 cells.insert( K.uIncident( pointel, 2, false ) );
651 }
652 return cells;
653 }
654
661 template <typename PointIterator>
662 static
663 std::unordered_set<typename KSpace::Cell>
665 PointIterator itB, PointIterator itE )
666 {
667 std::cout << "<1,3> specialization" << std::endl;
668 std::unordered_set<typename KSpace::Cell> cells;
669 for ( auto it = itB; it != itE; ++it )
670 {
671 auto pointel = K.uPointel( *it );
672 cells.insert( K.uIncident( pointel, 0, true ) );
673 cells.insert( K.uIncident( pointel, 0, false ) );
674 cells.insert( K.uIncident( pointel, 1, true ) );
675 cells.insert( K.uIncident( pointel, 1, false ) );
676 cells.insert( K.uIncident( pointel, 2, true ) );
677 cells.insert( K.uIncident( pointel, 2, false ) );
678 }
679 return cells;
680 }
681
687 template <typename PointIterator>
688 static
692 PointIterator itB, PointIterator itE )
693 {
696 for ( auto it = itB; it != itE; ++it )
697 {
698 auto kp = K.uKCoords( K.uPointel( *it ) );
699 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] , kp[ 2 ] );
700 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] , kp[ 2 ] );
701 kpoints.emplace( kp[ 0 ] , kp[ 1 ] - 1, kp[ 2 ] );
702 kpoints.emplace( kp[ 0 ] , kp[ 1 ] + 1, kp[ 2 ] );
703 kpoints.emplace( kp[ 0 ] , kp[ 1 ] , kp[ 2 ] - 1 );
704 kpoints.emplace( kp[ 0 ] , kp[ 1 ] , kp[ 2 ] + 1 );
705 }
706 return kpoints;
707 }
708
709 }; // end struct CellGeometryFunctions
710
713 template <typename TKSpace>
714 struct CellGeometryFunctions< TKSpace, 2, 2 >
715 {
717 BOOST_STATIC_ASSERT( TKSpace::dimension == 2 );
718 typedef TKSpace KSpace;
719 typedef typename KSpace::Space Space;
720 typedef typename KSpace::Cell Cell;
721
727 template <typename PointelIterator>
728 static
729 std::unordered_set<typename KSpace::Cell>
731 PointelIterator itB, PointelIterator itE )
732 {
733 std::unordered_set<typename KSpace::Cell> cells;
734 for ( auto it = itB; it != itE; ++it )
735 {
736 auto pointel = *it;
737 auto linelxp = K.uIncident( pointel, 0, true );
738 auto linelxm = K.uIncident( pointel, 0, false );
739 cells.insert( K.uIncident( linelxp, 1, true ) );
740 cells.insert( K.uIncident( linelxp, 1, false ) );
741 cells.insert( K.uIncident( linelxm, 1, true ) );
742 cells.insert( K.uIncident( linelxm, 1, false ) );
743 }
744 return cells;
745 }
746
753 template <typename PointIterator>
754 static
755 std::unordered_set<typename KSpace::Cell>
757 PointIterator itB, PointIterator itE )
758 {
759 std::cout << "<2,2> specialization" << std::endl;
760 std::unordered_set<typename KSpace::Cell> cells;
761 for ( auto it = itB; it != itE; ++it )
762 {
763 auto pointel = K.uPointel( *it );
764 auto linelxp = K.uIncident( pointel, 0, true );
765 auto linelxm = K.uIncident( pointel, 0, false );
766 cells.insert( K.uIncident( linelxp, 1, true ) );
767 cells.insert( K.uIncident( linelxp, 1, false ) );
768 cells.insert( K.uIncident( linelxm, 1, true ) );
769 cells.insert( K.uIncident( linelxm, 1, false ) );
770 }
771 return cells;
772 }
773
779 template <typename PointIterator>
780 static
784 PointIterator itB, PointIterator itE )
785 {
788 for ( auto it = itB; it != itE; ++it )
789 {
790 auto kp = K.uKCoords( K.uPointel( *it ) );
791 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] - 1 );
792 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] - 1 );
793 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] + 1 );
794 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] + 1 );
795 }
796 return kpoints;
797 }
798
799 }; // end struct CellGeometryFunctions
800
803 template <typename TKSpace>
804 struct CellGeometryFunctions< TKSpace, 2, 3 >
805 {
807 BOOST_STATIC_ASSERT( TKSpace::dimension == 2 );
808 typedef TKSpace KSpace;
809 typedef typename KSpace::Space Space;
810 typedef typename KSpace::Cell Cell;
811
817 template <typename PointelIterator>
818 static
819 std::unordered_set<typename KSpace::Cell>
821 PointelIterator itB, PointelIterator itE )
822 {
823 std::unordered_set<typename KSpace::Cell> cells;
824 for ( auto it = itB; it != itE; ++it )
825 {
826 auto pointel = *it;
827 auto linelxp = K.uIncident( pointel, 0, true );
828 auto linelxm = K.uIncident( pointel, 0, false );
829 auto linelyp = K.uIncident( pointel, 1, true );
830 auto linelym = K.uIncident( pointel, 1, false );
831 cells.insert( K.uIncident( linelxp, 1, true ) );
832 cells.insert( K.uIncident( linelxp, 1, false ) );
833 cells.insert( K.uIncident( linelxp, 2, true ) );
834 cells.insert( K.uIncident( linelxp, 2, false ) );
835 cells.insert( K.uIncident( linelxm, 1, true ) );
836 cells.insert( K.uIncident( linelxm, 1, false ) );
837 cells.insert( K.uIncident( linelxm, 2, true ) );
838 cells.insert( K.uIncident( linelxm, 2, false ) );
839 cells.insert( K.uIncident( linelyp, 2, true ) );
840 cells.insert( K.uIncident( linelyp, 2, false ) );
841 cells.insert( K.uIncident( linelym, 2, true ) );
842 cells.insert( K.uIncident( linelym, 2, false ) );
843 }
844 return cells;
845 }
846
853 template <typename PointIterator>
854 static
855 std::unordered_set<typename KSpace::Cell>
857 PointIterator itB, PointIterator itE )
858 {
859 std::cout << "<2,3> specialization" << std::endl;
860 std::unordered_set<typename KSpace::Cell> cells;
861 for ( auto it = itB; it != itE; ++it )
862 {
863 auto pointel = K.uPointel( *it );
864 auto linelxp = K.uIncident( pointel, 0, true );
865 auto linelxm = K.uIncident( pointel, 0, false );
866 auto linelyp = K.uIncident( pointel, 1, true );
867 auto linelym = K.uIncident( pointel, 1, false );
868 cells.insert( K.uIncident( linelxp, 1, true ) );
869 cells.insert( K.uIncident( linelxp, 1, false ) );
870 cells.insert( K.uIncident( linelxp, 2, true ) );
871 cells.insert( K.uIncident( linelxp, 2, false ) );
872 cells.insert( K.uIncident( linelxm, 1, true ) );
873 cells.insert( K.uIncident( linelxm, 1, false ) );
874 cells.insert( K.uIncident( linelxm, 2, true ) );
875 cells.insert( K.uIncident( linelxm, 2, false ) );
876 cells.insert( K.uIncident( linelyp, 2, true ) );
877 cells.insert( K.uIncident( linelyp, 2, false ) );
878 cells.insert( K.uIncident( linelym, 2, true ) );
879 cells.insert( K.uIncident( linelym, 2, false ) );
880 }
881 return cells;
882 }
883
889 template <typename PointIterator>
890 static
894 PointIterator itB, PointIterator itE )
895 {
898 for ( auto it = itB; it != itE; ++it )
899 {
900 auto kp = K.uKCoords( K.uPointel( *it ) );
901 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] - 1, kp[ 2 ] );
902 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] - 1, kp[ 2 ] );
903 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] + 1, kp[ 2 ] );
904 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] + 1, kp[ 2 ] );
905 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] , kp[ 2 ] - 1 );
906 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] , kp[ 2 ] - 1 );
907 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] , kp[ 2 ] + 1 );
908 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] , kp[ 2 ] + 1 );
909 kpoints.emplace( kp[ 0 ] , kp[ 1 ] - 1, kp[ 2 ] - 1 );
910 kpoints.emplace( kp[ 0 ] , kp[ 1 ] + 1, kp[ 2 ] - 1 );
911 kpoints.emplace( kp[ 0 ] , kp[ 1 ] - 1, kp[ 2 ] + 1 );
912 kpoints.emplace( kp[ 0 ] , kp[ 1 ] + 1, kp[ 2 ] + 1 );
913 }
914 return kpoints;
915 }
916
917 }; // end struct CellGeometryFunctions
918
921 template <typename TKSpace>
922 struct CellGeometryFunctions< TKSpace, 3, 3 >
923 {
925 BOOST_STATIC_ASSERT( TKSpace::dimension == 3 );
926 typedef TKSpace KSpace;
927 typedef typename KSpace::Space Space;
928 typedef typename KSpace::Cell Cell;
929
935 template <typename PointelIterator>
936 static
937 std::unordered_set<typename KSpace::Cell>
939 PointelIterator itB, PointelIterator itE )
940 {
941 std::unordered_set<typename KSpace::Cell> cells;
942 for ( auto it = itB; it != itE; ++it )
943 {
944 auto pointel = *it;
945 auto linelxp = K.uIncident( pointel, 0, true );
946 auto linelxm = K.uIncident( pointel, 0, false );
947 auto surfxpyp = K.uIncident( linelxp, 1, true );
948 auto surfxpym = K.uIncident( linelxp, 1, false );
949 auto surfxmyp = K.uIncident( linelxm, 1, true );
950 auto surfxmym = K.uIncident( linelxm, 1, false );
951 cells.insert( K.uIncident( surfxpyp, 2, true ) );
952 cells.insert( K.uIncident( surfxpyp, 2, false ) );
953 cells.insert( K.uIncident( surfxpym, 2, true ) );
954 cells.insert( K.uIncident( surfxpym, 2, false ) );
955 cells.insert( K.uIncident( surfxmyp, 2, true ) );
956 cells.insert( K.uIncident( surfxmyp, 2, false ) );
957 cells.insert( K.uIncident( surfxmym, 2, true ) );
958 cells.insert( K.uIncident( surfxmym, 2, false ) );
959 }
960 return cells;
961 }
962
969 template <typename PointIterator>
970 static
971 std::unordered_set<typename KSpace::Cell>
973 PointIterator itB, PointIterator itE )
974 {
975 std::unordered_set<typename KSpace::Cell> cells;
976 for ( auto it = itB; it != itE; ++it )
977 {
978 auto pointel = K.uPointel( *it );
979 auto linelxp = K.uIncident( pointel, 0, true );
980 auto linelxm = K.uIncident( pointel, 0, false );
981 auto surfxpyp = K.uIncident( linelxp, 1, true );
982 auto surfxpym = K.uIncident( linelxp, 1, false );
983 auto surfxmyp = K.uIncident( linelxm, 1, true );
984 auto surfxmym = K.uIncident( linelxm, 1, false );
985 cells.insert( K.uIncident( surfxpyp, 2, true ) );
986 cells.insert( K.uIncident( surfxpyp, 2, false ) );
987 cells.insert( K.uIncident( surfxpym, 2, true ) );
988 cells.insert( K.uIncident( surfxpym, 2, false ) );
989 cells.insert( K.uIncident( surfxmyp, 2, true ) );
990 cells.insert( K.uIncident( surfxmyp, 2, false ) );
991 cells.insert( K.uIncident( surfxmym, 2, true ) );
992 cells.insert( K.uIncident( surfxmym, 2, false ) );
993 }
994 return cells;
995 }
996
1002 template <typename PointIterator>
1003 static
1007 PointIterator itB, PointIterator itE )
1008 {
1011 for ( auto it = itB; it != itE; ++it )
1012 {
1013 auto kp = K.uKCoords( K.uPointel( *it ) );
1014 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] - 1, kp[ 2 ] - 1 );
1015 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] - 1, kp[ 2 ] - 1 );
1016 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] + 1, kp[ 2 ] - 1 );
1017 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] + 1, kp[ 2 ] - 1 );
1018 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] - 1, kp[ 2 ] + 1 );
1019 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] - 1, kp[ 2 ] + 1 );
1020 kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] + 1, kp[ 2 ] + 1 );
1021 kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] + 1, kp[ 2 ] + 1 );
1022 }
1023 return kpoints;
1024 }
1025
1026 }; // end struct CellGeometryFunctions
1027
1028
1029} // namespace DGtal
1030
1031
1033// Includes inline functions.
1034#include "CellGeometry.ih"
1035
1036// //
1038
1039#endif // !defined CellGeometry_h
1040
1041#undef CellGeometry_RECURSES
1042#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.
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