DGtal  1.1.0
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)
34 
35 #define CellGeometry_RECURSES
36 
37 #if !defined CellGeometry_h
38 
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 
58 namespace 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
90  typedef DGtal::int64_t BigInteger;
91 #endif
95 
97 
98 
101 
105  ~CellGeometry() = default;
106 
111 
116  CellGeometry ( const Self & other ) = default;
117 
122  CellGeometry ( Self && other ) = default;
123 
131  CellGeometry ( const KSpace & K,
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  template <typename PointIterator>
164  void addCellsTouchingPoints( PointIterator itB, PointIterator itE );
165 
168  template <typename PointelIterator>
169  void addCellsTouchingPointels( PointelIterator itB, PointelIterator itE );
170 
175 
180 
185  void addCellsTouchingPolytope( const LatticePolytope& polytope );
186 
192 
199 
201 
202  // ----------------------- Accessor services ------------------------------
203  public:
206 
208  Size nbCells() const;
212  Size computeNbCells(const Dimension k ) const;
219 
221 
222  // ----------------------- Cell services ------------------------------
223  public:
226 
236  bool subset( const CellGeometry& other ) const;
237 
247  bool subset( const CellGeometry& other, const Dimension k ) const;
248 
250 
251  // ----------------------- helper services ------------------------------
252  public:
255 
262  std::vector< Point >
263  getIntersectedKPoints( const LatticePolytope& polytope, const Dimension i ) const;
264 
271  std::vector< Point >
272  getIntersectedKPoints( const RationalPolytope& polytope, const Dimension i ) const;
273 
279  std::vector< Point >
280  getTouchedKPoints( const std::vector< Point >& points, const Dimension i ) const;
281 
282 
289  std::vector< Cell >
290  getIntersectedCells( const LatticePolytope& polytope, const Dimension i ) const;
291 
298  std::vector< Cell >
299  getIntersectedCells( const RationalPolytope& polytope, const Dimension i ) const;
300 
306  std::vector< Cell >
307  getTouchedCells( const std::vector< Point >& points, const Dimension i ) const;
308 
310 
311  // ----------------------- Khalimsky point services -------------------------------
312  public:
315 
319  static Dimension dim( const Point& kp );
320 
322 
323  // ----------------------- Interface --------------------------------------
324  public:
327 
332  void selfDisplay ( std::ostream & out ) const;
333 
339  bool isValid() const;
340 
344  std::string className() const;
345 
347 
348  // ------------------------- Protected Datas ------------------------------
349  protected:
350 
361  bool myVerbose;
362 
363  // ------------------------- Private Datas --------------------------------
364  private:
365 
366 
367  // ------------------------- Internals ------------------------------------
368  private:
369  // Internal method for cheking if sorted range [it1,itE1] is a
370  // subset of sorted range [it2, itE2]. Different from
371  // std::includes since it performs exponential march and dichotomy
372  // to walk faster along range [it1,itE1].
373  template <typename RandomIterator>
374  static
375  bool includes( RandomIterator it2, RandomIterator itE2,
376  RandomIterator it1, RandomIterator itE1 );
377 
378  }; // end of class CellGeometry
379 
382 
389  template <typename TKSpace>
390  std::ostream&
391  operator<< ( std::ostream & out,
392  const CellGeometry<TKSpace> & object );
393 
395 
403  template <typename TKSpace, int i, int N>
405  {
407  typedef TKSpace KSpace;
408  typedef typename KSpace::Space Space;
409  typedef typename KSpace::Cell Cell;
410  typedef typename KSpace::Point Point;
411 
418  template <typename PointelIterator>
419  static
420  std::unordered_set<typename KSpace::Cell>
422  PointelIterator itB, PointelIterator itE )
423  {
424  std::unordered_set<typename KSpace::Cell> cells;
425  if ( i == 0 )
426  for ( auto it = itB; it != itE; ++it )
427  cells.insert( *it );
428  else
429  for ( auto it = itB; it != itE; ++it )
430  {
431  auto pointel = *it;
432  auto cofaces = K.uCoFaces( pointel );
433  for ( auto&& f : cofaces )
434  if ( K.uDim( f ) == i ) cells.insert( f );
435  }
436  return cells;
437  }
438 
445  template <typename PointIterator>
446  static
447  std::unordered_set<typename KSpace::Cell>
449  PointIterator itB, PointIterator itE )
450  {
451  std::unordered_set<typename KSpace::Cell> cells;
452  if ( i == 0 )
453  for ( auto it = itB; it != itE; ++it )
454  cells.insert( K.uPointel( *it ) );
455  else
456  for ( auto it = itB; it != itE; ++it )
457  {
458  auto pointel = K.uPointel( *it );
459  auto cofaces = K.uCoFaces( pointel );
460  for ( auto&& f : cofaces )
461  if ( K.uDim( f ) == i ) cells.insert( f );
462  }
463  return cells;
464  }
465 
472  template <typename PointIterator>
473  static
477  PointIterator itB, PointIterator itE )
478  {
481  if ( i == 0 )
482  for ( auto it = itB; it != itE; ++it )
483  kpoints.insert( K.uKCoords( 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 ) kpoints.insert( K.uKCoords( f ) );
491  }
492  return kpoints;
493  }
494 
495 
496  }; // end struct CellGeometryFunctions
497 
500  template <typename TKSpace>
501  struct CellGeometryFunctions< TKSpace, 1, 2 >
502  {
504  BOOST_STATIC_ASSERT( TKSpace::dimension == 2 );
505  typedef TKSpace KSpace;
506  typedef typename KSpace::Space Space;
507  typedef typename KSpace::Cell Cell;
508 
514  template <typename PointelIterator>
515  static
516  std::unordered_set<typename KSpace::Cell>
518  PointelIterator itB, PointelIterator itE )
519  {
520  std::unordered_set<typename KSpace::Cell> cells;
521  for ( auto it = itB; it != itE; ++it )
522  {
523  auto pointel = *it;
524  cells.insert( K.uIncident( pointel, 0, true ) );
525  cells.insert( K.uIncident( pointel, 0, false ) );
526  cells.insert( K.uIncident( pointel, 1, true ) );
527  cells.insert( K.uIncident( pointel, 1, false ) );
528  }
529  return cells;
530  }
531 
537  template <typename PointIterator>
538  static
539  std::unordered_set<typename KSpace::Cell>
541  PointIterator itB, PointIterator itE )
542  {
543  std::unordered_set<typename KSpace::Cell> cells;
544  for ( auto it = itB; it != itE; ++it )
545  {
546  auto pointel = K.uPointel( *it );
547  cells.insert( K.uIncident( pointel, 0, true ) );
548  cells.insert( K.uIncident( pointel, 0, false ) );
549  cells.insert( K.uIncident( pointel, 1, true ) );
550  cells.insert( K.uIncident( pointel, 1, false ) );
551  }
552  return cells;
553  }
554 
560  template <typename PointIterator>
561  static
565  PointIterator itB, PointIterator itE )
566  {
569  for ( auto it = itB; it != itE; ++it )
570  {
571  auto kp = K.uKCoords( K.uPointel( *it ) );
572  kpoints.emplace( kp[ 0 ] , kp[ 1 ] - 1 );
573  kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] );
574  kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] );
575  kpoints.emplace( kp[ 0 ] , kp[ 1 ] + 1 );
576  }
577  return kpoints;
578  }
579 
580  }; // end struct CellGeometryFunctions
581 
584  template <typename TKSpace>
585  struct CellGeometryFunctions< TKSpace, 1, 3 >
586  {
588  BOOST_STATIC_ASSERT( TKSpace::dimension == 3 );
589  typedef TKSpace KSpace;
590  typedef typename KSpace::Space Space;
591  typedef typename KSpace::Cell Cell;
592 
598  template <typename PointelIterator>
599  static
600  std::unordered_set<typename KSpace::Cell>
602  PointelIterator itB, PointelIterator itE )
603  {
604  std::unordered_set<typename KSpace::Cell> cells;
605  for ( auto it = itB; it != itE; ++it )
606  {
607  auto pointel = *it;
608  cells.insert( K.uIncident( pointel, 0, true ) );
609  cells.insert( K.uIncident( pointel, 0, false ) );
610  cells.insert( K.uIncident( pointel, 1, true ) );
611  cells.insert( K.uIncident( pointel, 1, false ) );
612  cells.insert( K.uIncident( pointel, 2, true ) );
613  cells.insert( K.uIncident( pointel, 2, false ) );
614  }
615  return cells;
616  }
617 
624  template <typename PointIterator>
625  static
626  std::unordered_set<typename KSpace::Cell>
628  PointIterator itB, PointIterator itE )
629  {
630  std::cout << "<1,3> specialization" << std::endl;
631  std::unordered_set<typename KSpace::Cell> cells;
632  for ( auto it = itB; it != itE; ++it )
633  {
634  auto pointel = K.uPointel( *it );
635  cells.insert( K.uIncident( pointel, 0, true ) );
636  cells.insert( K.uIncident( pointel, 0, false ) );
637  cells.insert( K.uIncident( pointel, 1, true ) );
638  cells.insert( K.uIncident( pointel, 1, false ) );
639  cells.insert( K.uIncident( pointel, 2, true ) );
640  cells.insert( K.uIncident( pointel, 2, false ) );
641  }
642  return cells;
643  }
644 
650  template <typename PointIterator>
651  static
655  PointIterator itB, PointIterator itE )
656  {
659  for ( auto it = itB; it != itE; ++it )
660  {
661  auto kp = K.uKCoords( K.uPointel( *it ) );
662  kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] , kp[ 2 ] );
663  kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] , kp[ 2 ] );
664  kpoints.emplace( kp[ 0 ] , kp[ 1 ] - 1, kp[ 2 ] );
665  kpoints.emplace( kp[ 0 ] , kp[ 1 ] + 1, kp[ 2 ] );
666  kpoints.emplace( kp[ 0 ] , kp[ 1 ] , kp[ 2 ] - 1 );
667  kpoints.emplace( kp[ 0 ] , kp[ 1 ] , kp[ 2 ] + 1 );
668  }
669  return kpoints;
670  }
671 
672  }; // end struct CellGeometryFunctions
673 
676  template <typename TKSpace>
677  struct CellGeometryFunctions< TKSpace, 2, 2 >
678  {
680  BOOST_STATIC_ASSERT( TKSpace::dimension == 2 );
681  typedef TKSpace KSpace;
682  typedef typename KSpace::Space Space;
683  typedef typename KSpace::Cell Cell;
684 
690  template <typename PointelIterator>
691  static
692  std::unordered_set<typename KSpace::Cell>
694  PointelIterator itB, PointelIterator itE )
695  {
696  std::unordered_set<typename KSpace::Cell> cells;
697  for ( auto it = itB; it != itE; ++it )
698  {
699  auto pointel = *it;
700  auto linelxp = K.uIncident( pointel, 0, true );
701  auto linelxm = K.uIncident( pointel, 0, false );
702  cells.insert( K.uIncident( linelxp, 1, true ) );
703  cells.insert( K.uIncident( linelxp, 1, false ) );
704  cells.insert( K.uIncident( linelxm, 1, true ) );
705  cells.insert( K.uIncident( linelxm, 1, false ) );
706  }
707  return cells;
708  }
709 
716  template <typename PointIterator>
717  static
718  std::unordered_set<typename KSpace::Cell>
720  PointIterator itB, PointIterator itE )
721  {
722  std::cout << "<2,2> specialization" << std::endl;
723  std::unordered_set<typename KSpace::Cell> cells;
724  for ( auto it = itB; it != itE; ++it )
725  {
726  auto pointel = K.uPointel( *it );
727  auto linelxp = K.uIncident( pointel, 0, true );
728  auto linelxm = K.uIncident( pointel, 0, false );
729  cells.insert( K.uIncident( linelxp, 1, true ) );
730  cells.insert( K.uIncident( linelxp, 1, false ) );
731  cells.insert( K.uIncident( linelxm, 1, true ) );
732  cells.insert( K.uIncident( linelxm, 1, false ) );
733  }
734  return cells;
735  }
736 
742  template <typename PointIterator>
743  static
747  PointIterator itB, PointIterator itE )
748  {
751  for ( auto it = itB; it != itE; ++it )
752  {
753  auto kp = K.uKCoords( K.uPointel( *it ) );
754  kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] - 1 );
755  kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] - 1 );
756  kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] + 1 );
757  kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] + 1 );
758  }
759  return kpoints;
760  }
761 
762  }; // end struct CellGeometryFunctions
763 
766  template <typename TKSpace>
767  struct CellGeometryFunctions< TKSpace, 2, 3 >
768  {
770  BOOST_STATIC_ASSERT( TKSpace::dimension == 2 );
771  typedef TKSpace KSpace;
772  typedef typename KSpace::Space Space;
773  typedef typename KSpace::Cell Cell;
774 
780  template <typename PointelIterator>
781  static
782  std::unordered_set<typename KSpace::Cell>
784  PointelIterator itB, PointelIterator itE )
785  {
786  std::unordered_set<typename KSpace::Cell> cells;
787  for ( auto it = itB; it != itE; ++it )
788  {
789  auto pointel = *it;
790  auto linelxp = K.uIncident( pointel, 0, true );
791  auto linelxm = K.uIncident( pointel, 0, false );
792  auto linelyp = K.uIncident( pointel, 1, true );
793  auto linelym = K.uIncident( pointel, 1, false );
794  cells.insert( K.uIncident( linelxp, 1, true ) );
795  cells.insert( K.uIncident( linelxp, 1, false ) );
796  cells.insert( K.uIncident( linelxp, 2, true ) );
797  cells.insert( K.uIncident( linelxp, 2, false ) );
798  cells.insert( K.uIncident( linelxm, 1, true ) );
799  cells.insert( K.uIncident( linelxm, 1, false ) );
800  cells.insert( K.uIncident( linelxm, 2, true ) );
801  cells.insert( K.uIncident( linelxm, 2, false ) );
802  cells.insert( K.uIncident( linelyp, 2, true ) );
803  cells.insert( K.uIncident( linelyp, 2, false ) );
804  cells.insert( K.uIncident( linelym, 2, true ) );
805  cells.insert( K.uIncident( linelym, 2, false ) );
806  }
807  return cells;
808  }
809 
816  template <typename PointIterator>
817  static
818  std::unordered_set<typename KSpace::Cell>
820  PointIterator itB, PointIterator itE )
821  {
822  std::cout << "<2,3> specialization" << std::endl;
823  std::unordered_set<typename KSpace::Cell> cells;
824  for ( auto it = itB; it != itE; ++it )
825  {
826  auto pointel = K.uPointel( *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 
852  template <typename PointIterator>
853  static
857  PointIterator itB, PointIterator itE )
858  {
861  for ( auto it = itB; it != itE; ++it )
862  {
863  auto kp = K.uKCoords( K.uPointel( *it ) );
864  kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] - 1, kp[ 2 ] );
865  kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] - 1, kp[ 2 ] );
866  kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] + 1, kp[ 2 ] );
867  kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] + 1, kp[ 2 ] );
868  kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] , kp[ 2 ] - 1 );
869  kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] , kp[ 2 ] - 1 );
870  kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] , kp[ 2 ] + 1 );
871  kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] , kp[ 2 ] + 1 );
872  kpoints.emplace( kp[ 0 ] , kp[ 1 ] - 1, kp[ 2 ] - 1 );
873  kpoints.emplace( kp[ 0 ] , kp[ 1 ] + 1, kp[ 2 ] - 1 );
874  kpoints.emplace( kp[ 0 ] , kp[ 1 ] - 1, kp[ 2 ] + 1 );
875  kpoints.emplace( kp[ 0 ] , kp[ 1 ] + 1, kp[ 2 ] + 1 );
876  }
877  return kpoints;
878  }
879 
880  }; // end struct CellGeometryFunctions
881 
884  template <typename TKSpace>
885  struct CellGeometryFunctions< TKSpace, 3, 3 >
886  {
888  BOOST_STATIC_ASSERT( TKSpace::dimension == 3 );
889  typedef TKSpace KSpace;
890  typedef typename KSpace::Space Space;
891  typedef typename KSpace::Cell Cell;
892 
898  template <typename PointelIterator>
899  static
900  std::unordered_set<typename KSpace::Cell>
902  PointelIterator itB, PointelIterator itE )
903  {
904  std::unordered_set<typename KSpace::Cell> cells;
905  for ( auto it = itB; it != itE; ++it )
906  {
907  auto pointel = *it;
908  auto linelxp = K.uIncident( pointel, 0, true );
909  auto linelxm = K.uIncident( pointel, 0, false );
910  auto surfxpyp = K.uIncident( linelxp, 1, true );
911  auto surfxpym = K.uIncident( linelxp, 1, false );
912  auto surfxmyp = K.uIncident( linelxm, 1, true );
913  auto surfxmym = K.uIncident( linelxm, 1, false );
914  cells.insert( K.uIncident( surfxpyp, 2, true ) );
915  cells.insert( K.uIncident( surfxpyp, 2, false ) );
916  cells.insert( K.uIncident( surfxpym, 2, true ) );
917  cells.insert( K.uIncident( surfxpym, 2, false ) );
918  cells.insert( K.uIncident( surfxmyp, 2, true ) );
919  cells.insert( K.uIncident( surfxmyp, 2, false ) );
920  cells.insert( K.uIncident( surfxmym, 2, true ) );
921  cells.insert( K.uIncident( surfxmym, 2, false ) );
922  }
923  return cells;
924  }
925 
932  template <typename PointIterator>
933  static
934  std::unordered_set<typename KSpace::Cell>
936  PointIterator itB, PointIterator itE )
937  {
938  std::unordered_set<typename KSpace::Cell> cells;
939  for ( auto it = itB; it != itE; ++it )
940  {
941  auto pointel = K.uPointel( *it );
942  auto linelxp = K.uIncident( pointel, 0, true );
943  auto linelxm = K.uIncident( pointel, 0, false );
944  auto surfxpyp = K.uIncident( linelxp, 1, true );
945  auto surfxpym = K.uIncident( linelxp, 1, false );
946  auto surfxmyp = K.uIncident( linelxm, 1, true );
947  auto surfxmym = K.uIncident( linelxm, 1, false );
948  cells.insert( K.uIncident( surfxpyp, 2, true ) );
949  cells.insert( K.uIncident( surfxpyp, 2, false ) );
950  cells.insert( K.uIncident( surfxpym, 2, true ) );
951  cells.insert( K.uIncident( surfxpym, 2, false ) );
952  cells.insert( K.uIncident( surfxmyp, 2, true ) );
953  cells.insert( K.uIncident( surfxmyp, 2, false ) );
954  cells.insert( K.uIncident( surfxmym, 2, true ) );
955  cells.insert( K.uIncident( surfxmym, 2, false ) );
956  }
957  return cells;
958  }
959 
965  template <typename PointIterator>
966  static
970  PointIterator itB, PointIterator itE )
971  {
974  for ( auto it = itB; it != itE; ++it )
975  {
976  auto kp = K.uKCoords( K.uPointel( *it ) );
977  kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] - 1, kp[ 2 ] - 1 );
978  kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] - 1, kp[ 2 ] - 1 );
979  kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] + 1, kp[ 2 ] - 1 );
980  kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] + 1, kp[ 2 ] - 1 );
981  kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] - 1, kp[ 2 ] + 1 );
982  kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] - 1, kp[ 2 ] + 1 );
983  kpoints.emplace( kp[ 0 ] - 1, kp[ 1 ] + 1, kp[ 2 ] + 1 );
984  kpoints.emplace( kp[ 0 ] + 1, kp[ 1 ] + 1, kp[ 2 ] + 1 );
985  }
986  return kpoints;
987  }
988 
989  }; // end struct CellGeometryFunctions
990 
991 
992 } // namespace DGtal
993 
994 
996 // Includes inline functions.
997 #include "CellGeometry.ih"
998 
999 // //
1001 
1002 #endif // !defined CellGeometry_h
1003 
1004 #undef CellGeometry_RECURSES
1005 #endif // else defined(CellGeometry_RECURSES)
DGtal::CellGeometryFunctions< TKSpace, 2, 2 >::getIncidentCellsToPoints
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
Definition: CellGeometry.h:719
DGtal::CellGeometry::RationalPolytope
DGtal::BoundedRationalPolytope< Space > RationalPolytope
Definition: CellGeometry.h:94
DGtal::CellGeometry::CellGeometry
CellGeometry(const Self &other)=default
DGtal::CellGeometry::addCellsTouchingPoints
void addCellsTouchingPoints(PointIterator itB, PointIterator itE)
DGtal::CellGeometry::addCellsTouchingPolytopePoints
void addCellsTouchingPolytopePoints(const RationalPolytope &polytope)
DGtal::BigInteger
mpz_class BigInteger
Multi-precision integer with GMP implementation.
Definition: BasicTypes.h:79
DGtal::CellGeometry::addCellsTouchingPolytope
void addCellsTouchingPolytope(const LatticePolytope &polytope)
DGtal::CellGeometry::Point
KSpace::Point Point
Definition: CellGeometry.h:82
DGtal::CellGeometry::Cell
KSpace::Cell Cell
Definition: CellGeometry.h:84
DGtal::CellGeometry::isValid
bool isValid() const
DGtal::CellGeometry::operator+=
CellGeometry & operator+=(const CellGeometry &other)
DGtal::KhalimskySpaceND::dimension
static constexpr const Dimension dimension
Definition: KhalimskySpaceND.h:430
DGtal::CellGeometryFunctions< TKSpace, 2, 2 >::getIncidentKPointsToPoints
static UnorderedSetByBlock< typename KSpace::Point, Splitter< typename KSpace::Point, uint64_t > > getIncidentKPointsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
Definition: CellGeometry.h:746
DGtal::CellGeometryFunctions< TKSpace, 1, 2 >::KSpace
TKSpace KSpace
Definition: CellGeometry.h:505
DGtal::CellGeometry::CellGeometry
CellGeometry(Self &&other)=default
DGtal::CellGeometryFunctions< TKSpace, 2, 2 >::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
DGtal::KhalimskySpaceND::uDim
Dimension uDim(const Cell &p) const
Return the dimension of the cell [p].
DGtal::CellGeometry::LatticePolytope
DGtal::BoundedLatticePolytope< Space > LatticePolytope
Definition: CellGeometry.h:93
DGtal::CellGeometry::myMaxCellDim
Dimension myMaxCellDim
The maximal cell dimension.
Definition: CellGeometry.h:359
DGtal::CellGeometry::getIntersectedCells
std::vector< Cell > getIntersectedCells(const LatticePolytope &polytope, const Dimension i) const
DGtal::CellGeometry::Integer
KSpace::Integer Integer
Definition: CellGeometry.h:81
DGtal::CellGeometry::addCellsTouchingPolytope
void addCellsTouchingPolytope(const RationalPolytope &polytope)
DGtal::CellGeometryFunctions< TKSpace, 2, 3 >::getIncidentKPointsToPoints
static UnorderedSetByBlock< typename KSpace::Point, Splitter< typename KSpace::Point, uint64_t > > getIncidentKPointsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
Definition: CellGeometry.h:856
DGtal::CellGeometry::KSpace
TKSpace KSpace
Definition: CellGeometry.h:80
DGtal::CellGeometryFunctions< TKSpace, 1, 3 >::Cell
KSpace::Cell Cell
Definition: CellGeometry.h:591
DGtal::concepts::CCellularGridSpaceND
Aim: This concept describes a cellular grid space in nD. In these spaces obtained by cartesian produc...
Definition: CCellularGridSpaceND.h:164
DGtal::CellGeometry::subset
bool subset(const CellGeometry &other, const Dimension k) const
DGtal::CellGeometryFunctions< TKSpace, 1, 3 >::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
K
KSpace K
Definition: testCubicalComplex.cpp:62
DGtal::Dimension
DGtal::uint32_t Dimension
Definition: Common.h:133
DGtal::CellGeometryFunctions< TKSpace, 2, 2 >::getIncidentCellsToPointels
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPointels(const KSpace &K, PointelIterator itB, PointelIterator itE)
Definition: CellGeometry.h:693
DGtal::CellGeometry::getIntersectedCells
std::vector< Cell > getIntersectedCells(const RationalPolytope &polytope, const Dimension i) const
DGtal::CellGeometryFunctions< TKSpace, 3, 3 >::getIncidentKPointsToPoints
static UnorderedSetByBlock< typename KSpace::Point, Splitter< typename KSpace::Point, uint64_t > > getIncidentKPointsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
Definition: CellGeometry.h:969
DGtal::CellGeometryFunctions::getIncidentCellsToPointels
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPointels(const KSpace &K, PointelIterator itB, PointelIterator itE)
Definition: CellGeometry.h:421
DGtal::CellGeometry::myMinCellDim
Dimension myMinCellDim
The minimum cell dimension.
Definition: CellGeometry.h:357
DGtal::CellGeometryFunctions
Definition: CellGeometry.h:405
DGtal::Splitter
Definition: UnorderedSetByBlock.h:67
DGtal::CellGeometryFunctions< TKSpace, 1, 3 >::KSpace
TKSpace KSpace
Definition: CellGeometry.h:589
DGtal::CellGeometry::Vector
KSpace::Vector Vector
Definition: CellGeometry.h:83
DGtal::CellGeometryFunctions::Cell
KSpace::Cell Cell
Definition: CellGeometry.h:409
DGtal::CellGeometryFunctions::KSpace
TKSpace KSpace
Definition: CellGeometry.h:407
DGtal::CellGeometryFunctions< TKSpace, 3, 3 >::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
DGtal::CellGeometryFunctions< TKSpace, 3, 3 >::getIncidentCellsToPoints
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
Definition: CellGeometry.h:935
DGtal::CellGeometryFunctions< TKSpace, 2, 2 >::Space
KSpace::Space Space
Definition: CellGeometry.h:682
DGtal::CellGeometryFunctions< TKSpace, 1, 2 >::Space
KSpace::Space Space
Definition: CellGeometry.h:506
DGtal::CellGeometryFunctions< TKSpace, 2, 3 >::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
DGtal::CellGeometryFunctions< TKSpace, 2, 3 >::Cell
KSpace::Cell Cell
Definition: CellGeometry.h:773
DGtal::SpaceND
Definition: SpaceND.h:96
DGtal::KhalimskySpaceND::Point
PointVector< dim, Integer > Point
Definition: KhalimskySpaceND.h:425
DGtal::CellGeometryFunctions< TKSpace, 3, 3 >::getIncidentCellsToPointels
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPointels(const KSpace &K, PointelIterator itB, PointelIterator itE)
Definition: CellGeometry.h:901
DGtal::CellGeometry::includes
static bool includes(RandomIterator it2, RandomIterator itE2, RandomIterator it1, RandomIterator itE1)
DGtal::CellGeometryFunctions::Point
KSpace::Point Point
Definition: CellGeometry.h:410
DGtal::KhalimskySpaceND::uCoFaces
Cells uCoFaces(const Cell &c) const
Return the proper cofaces of [c] (chain of upper incidence) that belong to the space.
DGtal::CellGeometry::CellGeometry
CellGeometry()
DGtal::CellGeometry::Self
CellGeometry< TKSpace > Self
Definition: CellGeometry.h:79
DGtal::CellGeometryFunctions< TKSpace, 3, 3 >::Space
KSpace::Space Space
Definition: CellGeometry.h:890
DGtal::CellGeometryFunctions< TKSpace, 1, 3 >::getIncidentKPointsToPoints
static UnorderedSetByBlock< typename KSpace::Point, Splitter< typename KSpace::Point, uint64_t > > getIncidentKPointsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
Definition: CellGeometry.h:654
DGtal::CellGeometry::className
std::string className() const
DGtal::KhalimskySpaceND::Size
NumberTraits< Integer >::UnsignedVersion Size
Type used to represent sizes in the digital space.
Definition: KhalimskySpaceND.h:407
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition: ClosedIntegerHalfPlane.h:49
DGtal::CellGeometry::getTouchedCells
std::vector< Cell > getTouchedCells(const std::vector< Point > &points, const Dimension i) const
DGtal::CellGeometryFunctions< TKSpace, 1, 3 >::getIncidentCellsToPointels
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPointels(const KSpace &K, PointelIterator itB, PointelIterator itE)
Definition: CellGeometry.h:601
DGtal::CellGeometryFunctions< TKSpace, 2, 3 >::KSpace
TKSpace KSpace
Definition: CellGeometry.h:771
DGtal::CellGeometryFunctions< TKSpace, 1, 2 >::Cell
KSpace::Cell Cell
Definition: CellGeometry.h:507
DGtal::CellGeometryFunctions< TKSpace, 3, 3 >::KSpace
TKSpace KSpace
Definition: CellGeometry.h:889
DGtal::CellGeometryFunctions< TKSpace, 2, 2 >::Cell
KSpace::Cell Cell
Definition: CellGeometry.h:683
DGtal::CellGeometry::computeEuler
Integer computeEuler() const
DGtal::CellGeometry::minCellDim
Dimension minCellDim() const
DGtal::CellGeometryFunctions< TKSpace, 1, 2 >::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
DGtal::CellGeometry::computeNbCells
Size computeNbCells(const Dimension k) const
DGtal::CellGeometryFunctions< TKSpace, 2, 3 >::getIncidentCellsToPoints
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
Definition: CellGeometry.h:819
DGtal::CellGeometry::maxCellDim
Dimension maxCellDim() const
DGtal::CellGeometry::dim
static Dimension dim(const Point &kp)
DGtal::CellGeometryFunctions< TKSpace, 1, 3 >::getIncidentCellsToPoints
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
Definition: CellGeometry.h:627
DGtal::CellGeometry::dimension
static const Dimension dimension
Definition: CellGeometry.h:96
DGtal::CellGeometry::myKPoints
UnorderedSetByBlock< Point, Splitter< Point, uint64_t > > myKPoints
The unordered set that stores cells.
Definition: CellGeometry.h:355
DGtal::CellGeometry::Space
KSpace::Space Space
Definition: CellGeometry.h:85
DGtal::operator<<
std::ostream & operator<<(std::ostream &out, const ClosedIntegerHalfPlane< TSpace > &object)
DGtal::CellGeometryFunctions< TKSpace, 1, 3 >::Space
KSpace::Space Space
Definition: CellGeometry.h:590
DGtal::CellGeometry::nbCells
Size nbCells() const
DGtal::CellGeometry::operator=
Self & operator=(const Self &other)=default
DGtal::BoundedRationalPolytope
Aim: Represents an nD rational polytope, i.e. a convex polyhedron bounded by vertices with rational c...
Definition: BoundedRationalPolytope.h:75
DGtal::CellGeometryFunctions< TKSpace, 1, 2 >::getIncidentCellsToPointels
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPointels(const KSpace &K, PointelIterator itB, PointelIterator itE)
Definition: CellGeometry.h:517
DGtal::CellGeometryFunctions< TKSpace, 3, 3 >::Cell
KSpace::Cell Cell
Definition: CellGeometry.h:891
DGtal::CellGeometry::getIntersectedKPoints
std::vector< Point > getIntersectedKPoints(const RationalPolytope &polytope, const Dimension i) const
DGtal::CellGeometryFunctions< TKSpace, 2, 3 >::getIncidentCellsToPointels
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPointels(const KSpace &K, PointelIterator itB, PointelIterator itE)
Definition: CellGeometry.h:783
DGtal::KhalimskySpaceND::uKCoords
const Point & uKCoords(const Cell &c) const
Return its Khalimsky coordinates.
DGtal::CellGeometry
Aim: Computes and stores sets of cells and provides methods to compute intersections of lattice and r...
Definition: CellGeometry.h:75
DGtal::CellGeometryFunctions< TKSpace, 1, 2 >::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT(TKSpace::dimension==2)
DGtal::CellGeometry::addCellsTouchingPolytopePoints
void addCellsTouchingPolytopePoints(const LatticePolytope &polytope)
DGtal::CellGeometry::myK
KSpace myK
The cellular space for cells.
Definition: CellGeometry.h:352
DGtal::CellGeometry::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
DGtal::KhalimskySpaceND::uIncident
Cell uIncident(const Cell &c, Dimension k, bool up) const
Return the forward or backward unsigned cell incident to [c] along axis [k], depending on [up].
DGtal::PointVector< dim, Integer >
DGtal::CellGeometryFunctions< TKSpace, 1, 2 >::getIncidentCellsToPoints
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
Definition: CellGeometry.h:540
DGtal::CellGeometry::~CellGeometry
~CellGeometry()=default
DGtal::CellGeometry::BigInteger
DGtal::BigInteger BigInteger
Definition: CellGeometry.h:88
DGtal::CellGeometryFunctions::Space
KSpace::Space Space
Definition: CellGeometry.h:408
DGtal::CellGeometry::subset
bool subset(const CellGeometry &other) const
DGtal::KhalimskySpaceND::Integer
TInteger Integer
Arithmetic ring induced by (+,-,*) and Integer numbers.
Definition: KhalimskySpaceND.h:404
DGtal::BoundedLatticePolytope
Aim: Represents an nD lattice polytope, i.e. a convex polyhedron bounded with vertices with integer c...
Definition: BoundedLatticePolytope.h:75
DGtal::CellGeometryFunctions< TKSpace, 1, 2 >::getIncidentKPointsToPoints
static UnorderedSetByBlock< typename KSpace::Point, Splitter< typename KSpace::Point, uint64_t > > getIncidentKPointsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
Definition: CellGeometry.h:564
DGtal::CellGeometryFunctions::getIncidentCellsToPoints
static std::unordered_set< typename KSpace::Cell > getIncidentCellsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
Definition: CellGeometry.h:448
DGtal::int64_t
boost::int64_t int64_t
signed 94-bit integer.
Definition: BasicTypes.h:74
DGtal::CellGeometry::myVerbose
bool myVerbose
Tells if verbose mode.
Definition: CellGeometry.h:361
DGtal::CellGeometryFunctions< TKSpace, 2, 2 >::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT(TKSpace::dimension==2)
DGtal::CellGeometryFunctions< TKSpace, 2, 3 >::Space
KSpace::Space Space
Definition: CellGeometry.h:772
DGtal::UnorderedSetByBlock
Definition: UnorderedSetByBlock.h:163
DGtal::CellGeometryFunctions::getIncidentKPointsToPoints
static UnorderedSetByBlock< typename KSpace::Point, Splitter< typename KSpace::Point, uint64_t > > getIncidentKPointsToPoints(const KSpace &K, PointIterator itB, PointIterator itE)
Definition: CellGeometry.h:476
DGtal::CellGeometryFunctions< TKSpace, 2, 2 >::KSpace
TKSpace KSpace
Definition: CellGeometry.h:681
DGtal::CellGeometry::CellGeometry
CellGeometry(const KSpace &K, Dimension min_cell_dim=0, Dimension max_cell_dim=KSpace::dimension, bool verbose=false)
DGtal::CellGeometry::init
void init(const KSpace &K, Dimension min_cell_dim=0, Dimension max_cell_dim=KSpace::dimension, bool verbose=false)
DGtal::KhalimskySpaceND::uPointel
Cell uPointel(Point p) const
From the digital coordinates of a point in Zn, builds the corresponding pointel (cell of dimension 0)...
DGtal::CellGeometry::selfDisplay
void selfDisplay(std::ostream &out) const
DGtal::CellGeometry::getIntersectedKPoints
std::vector< Point > getIntersectedKPoints(const LatticePolytope &polytope, const Dimension i) const
DGtal::CellGeometryFunctions< TKSpace, 1, 3 >::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT(TKSpace::dimension==3)
DGtal::CellGeometryFunctions::BOOST_CONCEPT_ASSERT
BOOST_CONCEPT_ASSERT((concepts::CCellularGridSpaceND< TKSpace >))
DGtal::CellGeometry::Polytope
DGtal::BoundedLatticePolytope< Space > Polytope
Definition: CellGeometry.h:92
DGtal::KhalimskyCell< dim, Integer >
DGtal::CellGeometryFunctions< TKSpace, 3, 3 >::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT(TKSpace::dimension==3)
DGtal::CellGeometry::addCellsTouchingPointels
void addCellsTouchingPointels(PointelIterator itB, PointelIterator itE)
DGtal::CellGeometry::getTouchedKPoints
std::vector< Point > getTouchedKPoints(const std::vector< Point > &points, const Dimension i) const
DGtal::CellGeometryFunctions< TKSpace, 2, 3 >::BOOST_STATIC_ASSERT
BOOST_STATIC_ASSERT(TKSpace::dimension==2)
DGtal::CellGeometry::Size
KSpace::Size Size
Definition: CellGeometry.h:86