SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
iterator3d_box.hpp
Go to the documentation of this file.
1 /*
2  * Copyright(c):
3  * Signal Image and Communications (SIC) Department
4  * http://www.sic.sp2mi.univ-poitiers.fr/
5  * - University of Poitiers, France http://www.univ-poitiers.fr
6  * - XLIM Institute UMR CNRS 7252 http://www.xlim.fr/
7  *
8  * and
9  *
10  * D2 Fluid, Thermic and Combustion
11  * - University of Poitiers, France http://www.univ-poitiers.fr
12  * - PPRIME Institute - UPR CNRS 3346 http://www.pprime.fr
13  * - ISAE-ENSMA http://www.ensma.fr
14  *
15  * Contributor(s):
16  * The SLIP team,
17  * Benoit Tremblais <tremblais_AT_sic.univ-poitiers.fr>,
18  * Laurent David <laurent.david_AT_lea.univ-poitiers.fr>,
19  * Ludovic Chatellier <ludovic.chatellier_AT_univ-poitiers.fr>,
20  * Lionel Thomas <lionel.thomas_AT_univ-poitiers.fr>,
21  * Denis Arrivault <arrivault_AT_sic.univ-poitiers.fr>,
22  * Julien Dombre <julien.dombre_AT_univ-poitiers.fr>.
23  *
24  * Description:
25  * The Simple Library of Image Processing (SLIP) is a new image processing
26  * library. It is written in the C++ language following as much as possible
27  * the ISO/ANSI C++ standard. It is consequently compatible with any system
28  * satisfying the ANSI C++ complience. It works on different Unix , Linux ,
29  * Mircrosoft Windows and Mac OS X plateforms. SLIP is a research library that
30  * was created by the Signal, Image and Communications (SIC) departement of
31  * the XLIM, UMR 7252 CNRS Institute in collaboration with the Fluids, Thermic
32  * and Combustion departement of the P', UPR 3346 CNRS Institute of the
33  * University of Poitiers.
34  *
35  * The SLIP Library source code has been registered to the APP (French Agency
36  * for the Protection of Programs) by the University of Poitiers and CNRS,
37  * under registration number IDDN.FR.001.300034.000.S.P.2010.000.21000.
38 
39  * http://www.sic.sp2mi.univ-poitiers.fr/slip/
40  *
41  * This software is governed by the CeCILL-C license under French law and
42  * abiding by the rules of distribution of free software. You can use,
43  * modify and/ or redistribute the software under the terms of the CeCILL-C
44  * license as circulated by CEA, CNRS and INRIA at the following URL
45  * http://www.cecill.info.
46  * As a counterpart to the access to the source code and rights to copy,
47  * modify and redistribute granted by the license, users are provided only
48  * with a limited warranty and the software's author, the holder of the
49  * economic rights, and the successive licensors have only limited
50  * liability.
51  *
52  * In this respect, the user's attention is drawn to the risks associated
53  * with loading, using, modifying and/or developing or reproducing the
54  * software by the user in light of its specific status of free software,
55  * that may mean that it is complicated to manipulate, and that also
56  * therefore means that it is reserved for developers and experienced
57  * professionals having in-depth computer knowledge. Users are therefore
58  * encouraged to load and test the software's suitability as regards their
59  * requirements in conditions enabling the security of their systems and/or
60  * data to be ensured and, more generally, to use and operate it in the
61  * same conditions as regards security.
62  *
63  * The fact that you are presently reading this means that you have had
64  * knowledge of the CeCILL-C license and that you accept its terms.
65  */
66 
67 
68 
77 #ifndef SLIP_ITERATOR3D_BOX_HPP
78 #define SLIP_ITERATOR3D_BOX_HPP
79 
80 #include <iterator>
81 #include <cassert>
82 
83 #include "DPoint2d.hpp"
84 #include "Point3d.hpp"
85 #include "DPoint3d.hpp"
86 #include "Box3d.hpp"
87 #include "iterator_types.hpp"
88 #include "iterator3d_plane.hpp"
89 
90 namespace slip
91 {
111  template <class Container3D>
112  class iterator3d_box
113  {
114  public:
115  //typedef std::random_access_iterator_tag iterator_category;
117  typedef typename Container3D::value_type value_type;
120  typedef typename Container3D::pointer pointer;
121  typedef typename Container3D::reference reference;
122 
123  typedef iterator3d_box self;
124  typedef typename Container3D::size_type size_type;
125 
130 
136  cont3d_(0),pos_(0),x1_(0),x2_(0),x3_(0),box_(0,0,0,0,0,0)
137  {}
138 
145  iterator3d_box(Container3D* c,
146  const Box3d<int>& b):
147  cont3d_(c),pos_((*c)[(b.front_upper_left())[0]][(b.front_upper_left())[1]] + (b.front_upper_left())[2]),x1_((b.front_upper_left())[0]),x2_((b.front_upper_left())[1]),x3_((b.front_upper_left())[2]),box_(b)
148  {}
149 
155  iterator3d_box(const self& o):
156  cont3d_(o.cont3d_),pos_(o.pos_),x1_(o.x1_),x2_(o.x2_),x3_(o.x3_),box_(o.box_)
157  {}
158 
173  self& operator=(const self& o)
174  {
175  if(this != &o)
176  {
177  this->cont3d_ = o.cont3d_;
178  this->pos_ = o.pos_;
179  this->x1_ = o.x1_;
180  this->x2_ = o.x2_;
181  this->x3_ = o.x3_;
182  this->box_ = o.box_;
183  }
184  return *this;
185  }
194  inline
196  {
197  return *pos_;
198  }
199 
200 
201 
208  inline
209  const reference operator*() const
210  {
211  return *pos_;
212  }
213 
214 
215  inline
217  {
218  return &(operator*());
219  }
220 
221  inline
223  {
224  return &(operator*());
225  }
226 
231 
237  inline
238  self& operator++()
239  {
240  if(x3_ < (box_.back_bottom_right())[2])
241  {
242  this->x3_++;
243  this->pos_++;
244  }
245  else if(x2_ < (box_.back_bottom_right())[1])
246  {
247  this->x2_++;
248  this->x3_ = (box_.front_upper_left())[2];
249  this->pos_ = cont3d_->begin() +
250  (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) +
251  (this->x2_* int(cont3d_->cols())) + this->x3_;
252  }
253  else if(x1_ < (box_.back_bottom_right())[0])
254  {
255  this->x1_++;
256  this->x2_ = (box_.front_upper_left())[1];
257  this->x3_ = (box_.front_upper_left())[2];
258  this->pos_ = cont3d_->begin() +
259  (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) +
260  (this->x2_* int(cont3d_->cols())) + this->x3_;
261  }
262  else
263  {
264  this->x1_ = (box_.back_bottom_right())[0] + 1;
265  this->x2_ = (box_.back_bottom_right())[1] + 1;
266  this->x3_ = (box_.back_bottom_right())[2] + 1;
267  this->pos_ = cont3d_->begin() +
268  (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) +
269  (this->x2_* int(cont3d_->cols())) + this->x3_;
270  }
271  return *this;
272  }
273 
279  inline
280  self operator++(int)
281  {
282  self tmp = *this;
283  ++(*this);
284  return tmp;
285  }
286 
298  inline
299  self& operator--()
300  {
301  if(x3_ > (box_.front_upper_left())[2])
302  {
303  this->x3_--;
304  this->pos_--;
305  }
306  else if (x2_ > (box_.front_upper_left())[1])
307  {
308  this->x2_--;
309  this->x3_ = (box_.back_bottom_right())[2];
310  this->pos_ = cont3d_->begin() +
311  (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) +
312  (this->x2_* int(cont3d_->cols())) + this->x3_;
313  }
314  else if (x1_ > (box_.front_upper_left())[0])
315  {
316  this->x1_--;
317  this->x2_ = (box_.back_bottom_right())[1];
318  this->x3_ = (box_.back_bottom_right())[2];
319  this->pos_ = cont3d_->begin() +
320  (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) +
321  (this->x2_* int(cont3d_->cols())) + this->x3_;
322  }
323  else
324  {
325  this->x1_ = (box_.front_upper_left())[0] - 1;
326  this->x2_ = (box_.front_upper_left())[1] - 1;
327  this->x3_ = (box_.front_upper_left())[2] - 1;
328  this->pos_ = cont3d_->begin() +
329  (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) +
330  (this->x2_* int(cont3d_->cols())) + this->x3_;
331  }
332 
333  return *this;
334  }
335 
341  inline
342  self operator--(int)
343  {
344  self tmp = *this;
345  --(*this);
346  return tmp;
347  }
348 
362  inline
363  friend bool operator==(const self& i1,
364  const self& i2)
365  {
366 
367  return ( (i1.cont3d_ == i2.cont3d_) && (i1.pos_ == i2.pos_)
368  && (i1.x1_ == i2.x1_) && (i1.x2_ == i2.x2_) && (i1.x3_ == i2.x3_));
369  }
370 
377  inline
378  friend bool operator!=(const self& i1,
379  const self& i2)
380  {
381  return ( (i1.cont3d_ != i2.cont3d_) || (i1.pos_ != i2.pos_)
382  || (i1.x1_ != i2.x1_) || (i1.x2_ != i2.x2_) || (i1.x3_ != i2.x3_));
383  }
396  inline
397  friend bool operator<(const self& i1,
398  const self& i2)
399  {
400 
401  return ( i1.pos_ < i2.pos_);
402  }
403 
410  inline
411  friend bool operator>(const self& i1,
412  const self& i2)
413  {
414 
415  return (i2 < i1);
416  }
417 
424  inline
425  friend bool operator<=(const self& i1,
426  const self& i2)
427  {
428 
429  return !(i2 < i1);
430  }
431 
438  inline
439  friend bool operator>=(const self& i1,
440  const self& i2)
441  {
442 
443  return !(i1 < i2);
444  }
459  inline
460  self& operator+=(const difference_type& d)
461  {
462  this->x1_ += d.dx1();
463  this->x2_ += d.dx2();
464  this->x3_ += d.dx3();
465  this->pos_ = cont3d_->begin() +
466  (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) +
467  (this->x2_* int(cont3d_->cols())) + this->x3_;
468  return *this;
469  }
470 
471 
472 
480  inline
481  self& operator-=(const difference_type& d)
482  {
483  this->x1_ -= d.dx1();
484  this->x2_ -= d.dx2();
485  this->x3_ -= d.dx3();
486  this->pos_ = cont3d_->begin() +
487  (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) +
488  (this->x2_* int(cont3d_->cols())) + this->x3_;
489  return *this;
490  }
491 
492 
493 
501  inline
502  self operator+(const difference_type& d)
503  {
504  self tmp = *this;
505  tmp += d;
506  return tmp;
507  }
508 
516  inline
517  self operator-(const difference_type& d)
518  {
519  self tmp = *this;
520  tmp -= d;
521  return tmp;
522  }
523 
531  inline
532  friend difference_type operator-(const self& i1,
533  const self& i2)
534  {
535  return difference_type(int(i1.x1_ - i2.x1_),int(i1.x2_ - i2.x2_),int(i1.x3_ - i2.x3_));
536  }
537 
538 
547  inline
549  {
550  return (*cont3d_)[this->x1_+d.dx1()][this->x2_+d.dx2()][this->x3_+d.dx3()];
551  }
552 
562  inline
564  {
565  return (*cont3d_)[this->x1_+ d.dx1()][this->x2_ + d.dx2()];
566  }
567 
577  inline
579  {
580  return (*cont3d_)[this->x1_+ n];
581  }
582 
583 
584 
593  inline
594  const pointer* operator[](int n) const
595  {
596  return (*cont3d_)[this->x1_+ n];
597  }
598 
607  inline
608  typename Container3D::slice_iterator slice_begin(size_type row, size_type col)
609  {
610  return cont3d_->slice_begin(this->box_.front_upper_left()[1] + row, this->box_.front_upper_left()[2] + col) + this->box_.front_upper_left()[0];
611  }
612 
621  inline
622  typename Container3D::slice_iterator slice_end(size_type row, size_type col)
623  {
624  return this->slice_begin(row,col) + this->box_.depth();
625  }
626 
627 
636  inline
637  typename Container3D::row_iterator row_begin(size_type slice, size_type row)
638  {
639  return cont3d_->row_begin(this->box_.front_upper_left()[0] + slice, this->box_.front_upper_left()[1] + row) + this->box_.front_upper_left()[2];
640  }
641 
650  inline
651  typename Container3D::row_iterator row_end(size_type slice, size_type row)
652  {
653  return this->row_begin(slice,row) + this->box_.width();
654  }
655 
664  inline
665  typename Container3D::col_iterator col_begin(size_type slice, size_type col)
666  {
667  return cont3d_->col_begin(this->box_.front_upper_left()[0] + slice, this->box_.front_upper_left()[2] + col) + this->box_.front_upper_left()[1];
668  }
669 
678  inline
679  typename Container3D::col_iterator col_end(size_type slice, size_type col)
680  {
681  return this->col_begin(slice,col) + this->box_.height();
682  }
683 
693  inline
694  typename Container3D::iterator2d plane_upper_left(const slip::PLANE_ORIENTATION p, const size_type xp)
695  {
696  if(p==0)
697  {
698  slip::Box2d<int> b(this->box_.front_upper_left()[1],this->box_.front_upper_left()[2],this->box_.back_bottom_right()[1],this->box_.back_bottom_right()[2]);
699  return cont3d_->plane_upper_left(p,this->box_.front_upper_left()[0] + xp,b);
700  }
701  if(p==1)
702  {
703  slip::Box2d<int> b(this->box_.front_upper_left()[0],this->box_.front_upper_left()[2],this->box_.back_bottom_right()[0],this->box_.back_bottom_right()[2]);
704  return cont3d_->plane_upper_left(p,this->box_.front_upper_left()[1] + xp,b);
705  }
706  slip::Box2d<int> b(this->box_.front_upper_left()[0],this->box_.front_upper_left()[1],this->box_.back_bottom_right()[0],this->box_.back_bottom_right()[1]);
707  return cont3d_->plane_upper_left(p,this->box_.front_upper_left()[2] + xp,b);
708  }
709 
718  inline
719  typename Container3D::iterator2d plane_bottom_right(const slip::PLANE_ORIENTATION p, const size_type xp)
720  {
721  if(p==0)
722  {
723  slip::Box2d<int> b(this->box_.front_upper_left()[1],this->box_.front_upper_left()[2],this->box_.back_bottom_right()[1],this->box_.back_bottom_right()[2]);
724  return cont3d_->plane_bottom_right(p,this->box_.front_upper_left()[0] + xp,b);
725  }
726  if(p==1)
727  {
728  slip::Box2d<int> b(this->box_.front_upper_left()[0],this->box_.front_upper_left()[2],this->box_.back_bottom_right()[0],this->box_.back_bottom_right()[2]);
729  return cont3d_->plane_bottom_right(p,this->box_.front_upper_left()[1] + xp,b);
730  }
731  slip::Box2d<int> b(this->box_.front_upper_left()[0],this->box_.front_upper_left()[1],this->box_.back_bottom_right()[0],this->box_.back_bottom_right()[1]);
732  return cont3d_->plane_bottom_right(p,this->box_.front_upper_left()[2] + xp,b);
733  }
734 
735 
736 
748  inline
749  int x1() const
750  {
751  return this->x1_;
752  }
757  inline
758  int k() const
759  {
760  return this->x1_;
761  }
766  inline
767  int x2() const
768  {
769  return this->x2_;
770  }
775  inline
776  int i() const
777  {
778  return this->x2_;
779  }
784  inline
785  int x3() const
786  {
787  return this->x3_;
788  }
793  inline
794  int j() const
795  {
796  return this->x3_;
797  }
798 
803  private:
804  Container3D* cont3d_; // pointer to the 3d container
805  pointer pos_; // linear position within the container
806  int x1_; // first subscript position
807  int x2_; // second subscript position
808  int x3_; // third subscript position
809  Box3d<int> box_; // box to iterate
810  };
811 
812 
835  template <class Container3D>
836  class const_iterator3d_box
837  {
838  public:
839  //typedef std::random_access_iterator_tag iterator_category;
841  typedef typename Container3D::value_type value_type;
844  typedef typename Container3D::const_pointer pointer;
845  typedef typename Container3D::const_reference reference;
846 
847  typedef const_iterator3d_box self;
848 
849  typedef typename Container3D::size_type size_type;
854 
860  cont3d_(0),pos_(0),x1_(0),x2_(0),x3_(0),box_(0,0,0,0,0,0)
861  {}
862 
869  const_iterator3d_box(Container3D* c, const Box3d<int>& b):
870  cont3d_(c),pos_((*c)[(b.front_upper_left())[0]][(b.front_upper_left())[1]] + (b.front_upper_left())[2])
871  ,x1_((b.front_upper_left())[0]),x2_((b.front_upper_left())[1]),x3_((b.front_upper_left())[2]),box_(b)
872  {}
873 
879  const_iterator3d_box(const self& o):
880  cont3d_(o.cont3d_),pos_(o.pos_),x1_(o.x1_),x2_(o.x2_),x3_(o.x3_),box_(o.box_)
881  {}
882 
897  self& operator=(const self& o)
898  {
899  if(this != &o)
900  {
901  this->cont3d_ = o.cont3d_;
902  this->pos_ = o.pos_;
903  this->x1_ = o.x1_;
904  this->x2_ = o.x2_;
905  this->x3_ = o.x3_;
906  this->box_ = o.box_;
907  }
908  return *this;
909  }
921  inline
923  {
924  return *pos_;
925  }
926 
927 
928  inline
930  {
931  return &(operator*());
932  }
933 
938 
944  inline
945  self& operator++()
946  {
947  if(x3_ < (box_.back_bottom_right())[2])
948  {
949  this->x3_++;
950  this->pos_++;
951  }
952  else if(x2_ < (box_.back_bottom_right())[1])
953  {
954  this->x2_++;
955  this->x3_ = (box_.front_upper_left())[2];
956  this->pos_ = cont3d_->begin() +
957  (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) +
958  (this->x2_* int(cont3d_->cols())) + this->x3_;
959  }
960  else if(x1_ < (box_.back_bottom_right())[0])
961  {
962  this->x1_++;
963  this->x2_ = (box_.front_upper_left())[1];
964  this->x3_ = (box_.front_upper_left())[2];
965  this->pos_ = cont3d_->begin() +
966  (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) +
967  (this->x2_* int(cont3d_->cols())) + this->x3_;
968  }
969  else
970  {
971  this->x1_ = (box_.back_bottom_right())[0] + 1;
972  this->x2_ = (box_.back_bottom_right())[1] + 1;
973  this->x3_ = (box_.back_bottom_right())[2] + 1;
974  this->pos_ = cont3d_->begin() +
975  (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) +
976  (this->x2_* int(cont3d_->cols())) + this->x3_;
977  }
978  return *this;
979  }
980 
986  inline
987  self operator++(int)
988  {
989  self tmp = *this;
990  ++(*this);
991  return tmp;
992  }
993 
1005  inline
1006  self& operator--()
1007  {
1008  if(x3_ > (box_.front_upper_left())[2])
1009  {
1010  this->x3_--;
1011  this->pos_--;
1012  }
1013  else if (x2_ > (box_.front_upper_left())[1])
1014  {
1015  this->x2_--;
1016  this->x3_ = (box_.back_bottom_right())[2];
1017  this->pos_ = cont3d_->begin() +
1018  (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) +
1019  (this->x2_* int(cont3d_->cols())) + this->x3_;
1020  }
1021  else if (x1_ > (box_.front_upper_left())[0])
1022  {
1023  this->x1_--;
1024  this->x2_ = (box_.back_bottom_right())[1];
1025  this->x3_ = (box_.back_bottom_right())[2];
1026  this->pos_ = cont3d_->begin() +
1027  (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) +
1028  (this->x2_* int(cont3d_->cols())) + this->x3_;
1029  }
1030  else
1031  {
1032  this->x1_ = (box_.front_upper_left())[0] - 1;
1033  this->x2_ = (box_.front_upper_left())[1] - 1;
1034  this->x3_ = (box_.front_upper_left())[2] - 1;
1035  this->pos_ = cont3d_->begin() +
1036  (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) +
1037  (this->x2_* int(cont3d_->cols())) + this->x3_;
1038  }
1039  return *this;
1040  }
1041 
1047  inline
1048  self operator--(int)
1049  {
1050  self tmp = *this;
1051  --(*this);
1052  return tmp;
1053  }
1054 
1068  inline
1069  friend bool operator==(const self& i1,
1070  const self& i2)
1071  {
1072 
1073  return ( (i1.cont3d_ == i2.cont3d_) && (i1.pos_ == i2.pos_)
1074  && (i1.x1_ == i2.x1_) && (i1.x2_ == i2.x2_) && (i1.x3_ == i2.x3_) );
1075  }
1076 
1083  inline
1084  friend bool operator!=(const self& i1,
1085  const self& i2)
1086  {
1087  return ( (i1.cont3d_ != i2.cont3d_) || (i1.pos_ != i2.pos_)
1088  || (i1.x1_ != i2.x1_) || (i1.x2_ != i2.x2_) || (i1.x3_ != i2.x3_) );
1089  }
1102  inline
1103  friend bool operator<(const self& i1,
1104  const self& i2)
1105  {
1106 
1107  return ( i1.pos_ < i2.pos_);
1108  }
1109 
1116  inline
1117  friend bool operator>(const self& i1,
1118  const self& i2)
1119  {
1120 
1121  return (i2 < i1);
1122  }
1123 
1130  inline
1131  friend bool operator<=(const self& i1,
1132  const self& i2)
1133  {
1134 
1135  return !(i2 < i1);
1136  }
1137 
1144  inline
1145  friend bool operator>=(const self& i1,
1146  const self& i2)
1147  {
1148 
1149  return !(i1 < i2);
1150  }
1164  inline
1165  self& operator+=(const difference_type& d)
1166  {
1167  this->x1_ += d.dx1();
1168  this->x2_ += d.dx2();
1169  this->x3_ += d.dx3();
1170  this->pos_ = cont3d_->begin() +
1171  (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) +
1172  (this->x2_* int(cont3d_->cols())) + this->x3_;
1173  return *this;
1174  }
1175 
1176 
1177 
1185  inline
1186  self& operator-=(const difference_type& d)
1187  {
1188  this->x1_ -= d.dx1();
1189  this->x2_ -= d.dx2();
1190  this->x3_ -= d.dx3();
1191  this->pos_ = cont3d_->begin() +
1192  (this->x1_ * int(cont3d_->rows() * int(cont3d_->cols()))) +
1193  (this->x2_* int(cont3d_->cols())) + this->x3_;
1194  return *this;
1195  }
1196 
1197 
1198 
1206  inline
1208  {
1209  self tmp = *this;
1210  tmp += d;
1211  return tmp;
1212  }
1213 
1214 
1222  inline
1224  {
1225  self tmp = *this;
1226  tmp -= d;
1227  return tmp;
1228  }
1229 
1230 
1238  inline
1239  friend difference_type operator-(const self& i1,
1240  const self& i2)
1241  {
1242  return difference_type(int(i1.x1_ - i2.x1_),int(i1.x2_ - i2.x2_),int(i1.x3_ - i2.x3_));
1243  }
1244 
1252  inline
1254  {
1255  return (*cont3d_)[this->x1_+d.dx1()][this->x2_+d.dx2()][this->x3_+d.dx3()];
1256  }
1257 
1267  inline
1269  {
1270  return (*cont3d_)[this->x1_+ d.dx1()][this->x2_ + d.dx2()];
1271  }
1272 
1273 
1282  inline
1283  pointer* operator[](int n) const
1284  {
1285  return (*cont3d_)[this->x1_+ n];
1286  }
1287 
1296  inline
1297  typename Container3D::const_slice_iterator slice_begin(size_type row, size_type col) const
1298  {
1299  Container3D const * tp(cont3d_);
1300  return tp->slice_begin(this->box_.front_upper_left()[1] + row, this->box_.front_upper_left()[2] + col) + this->box_.front_upper_left()[0];
1301  }
1302 
1311  inline
1312  typename Container3D::const_slice_iterator slice_end(size_type row, size_type col) const
1313  {
1314  Container3D const * tp(cont3d_);
1315  return this->slice_begin(row,col) + this->box_.depth();
1316  }
1317 
1326  inline
1327  typename Container3D::const_row_iterator row_begin(size_t slice, size_type row) const
1328  {
1329  Container3D const * tp(cont3d_);
1330  return tp->row_begin(this->box_.front_upper_left()[0] + slice, this->box_.front_upper_left()[1] + row) + this->box_.front_upper_left()[2];
1331  }
1332 
1333 
1342  inline
1343  typename Container3D::const_row_iterator row_end(size_t slice, size_type row) const
1344  {
1345  return this->row_begin(slice,row) + this->box_.width();
1346  }
1347 
1348 
1349 
1358  inline
1359  typename Container3D::const_col_iterator col_begin(size_t slice, size_type col) const
1360  {
1361  Container3D const * tp(cont3d_);
1362  return tp->col_begin(this->box_.front_upper_left()[0] + slice, this->box_.front_upper_left()[2] + col) + this->box_.front_upper_left()[1];
1363  }
1364 
1365 
1374  inline
1375  typename Container3D::const_col_iterator col_end(size_t slice, size_type col) const
1376  {
1377  return this->col_begin(slice,col) + this->box_.height();
1378  }
1379 
1389  inline
1390  typename Container3D::const_iterator2d plane_upper_left(const slip::PLANE_ORIENTATION p, const size_type xp)
1391  {
1392  Container3D const * tp(cont3d_);
1393  if(p==0)
1394  {
1395  slip::Box2d<int> b(this->box_.front_upper_left()[1],this->box_.front_upper_left()[2],this->box_.back_bottom_right()[1],this->box_.back_bottom_right()[2]);
1396  return tp->plane_upper_left(p,this->box_.front_upper_left()[0] + xp,b);
1397  }
1398  if(p==1)
1399  {
1400  slip::Box2d<int> b(this->box_.front_upper_left()[0],this->box_.front_upper_left()[2],this->box_.back_bottom_right()[0],this->box_.back_bottom_right()[2]);
1401  return tp->plane_upper_left(p,this->box_.front_upper_left()[1] + xp,b);
1402  }
1403  slip::Box2d<int> b(this->box_.front_upper_left()[0],this->box_.front_upper_left()[1],this->box_.back_bottom_right()[0],this->box_.back_bottom_right()[1]);
1404  return tp->plane_upper_left(p,this->box_.front_upper_left()[2] + xp,b);
1405  }
1406 
1415  inline
1416  typename Container3D::const_iterator2d plane_bottom_right(const slip::PLANE_ORIENTATION p, const size_type xp)
1417  {
1418  Container3D const * tp(cont3d_);
1419  if(p==0)
1420  {
1421  slip::Box2d<int> b(this->box_.front_upper_left()[1],this->box_.front_upper_left()[2],this->box_.back_bottom_right()[1],this->box_.back_bottom_right()[2]);
1422  return tp->plane_bottom_right(p,this->box_.front_upper_left()[0] + xp,b);
1423  }
1424  if(p==1)
1425  {
1426  slip::Box2d<int> b(this->box_.front_upper_left()[0],this->box_.front_upper_left()[2],this->box_.back_bottom_right()[0],this->box_.back_bottom_right()[2]);
1427  return tp->plane_bottom_right(p,this->box_.front_upper_left()[1] + xp,b);
1428  }
1429  slip::Box2d<int> b(this->box_.front_upper_left()[0],this->box_.front_upper_left()[1],this->box_.back_bottom_right()[0],this->box_.back_bottom_right()[1]);
1430  return tp->plane_bottom_right(p,this->box_.front_upper_left()[2] + xp,b);
1431  }
1432 
1433 
1441 
1446  inline
1447  int x1() const
1448  {
1449  return this->x1_;
1450  }
1455  inline
1456  int k() const
1457  {
1458  return this->x1_;
1459  }
1464  inline
1465  int x2() const
1466  {
1467  return this->x2_;
1468  }
1473  inline
1474  int i() const
1475  {
1476  return this->x2_;
1477  }
1482  inline
1483  int x3() const
1484  {
1485  return this->x3_;
1486  }
1491  inline
1492  int j() const
1493  {
1494  return this->x3_;
1495  }
1496 
1501  private:
1502  Container3D* cont3d_; // pointer to the 3d container
1503  pointer pos_; // linear position within the container
1504  int x1_; // first subscript position
1505  int x2_; // second subscript position
1506  int x3_;
1507  Box3d<int> box_; // box to iterate
1508  };
1509 
1510 
1511 
1512 }//slip::
1513 
1514 #endif //SLIP_ITERATOR3D_BOX_HPP
self operator++(int)
Postincrement a const_iterator3d_box. Iterate to the next location inside the Box3d.
int i() const
Access to the first subscript of the current const_iterator3d_box.
self & operator--()
Predecrement a iterator3d_box. Iterate to the previous location inside the Box3d. ...
Container3D::const_row_iterator row_end(size_t slice, size_type row) const
const_iterator3d_box element assignment operator.
self & operator=(const self &o)
Assign a iterator3d_box.
int x3() const
Access to the second subscript of the current const_iterator3d_box.
Provides a class to modelize 3d points.
Provides a class to modelize the difference of slip::Point2d.
void dx3(const CoordType &dx)
Accessor of the first coordinate of DPoint3d.
Definition: DPoint3d.hpp:273
friend bool operator>(const self &i1, const self &i2)
operator.
CoordType width() const
compute the width of the Box3d.
Definition: Box3d.hpp:408
Container3D::const_col_iterator col_begin(size_t slice, size_type col) const
const_iterator3d_box element assignment operator.
Container3D::value_type value_type
pointer * operator[](int n)
iterator3d_box element assignment operator. Equivalent to *(k + n).
friend bool operator>=(const self &i1, const self &i2)
>= operator.
void dx2(const CoordType &dx)
Accessor of the second coordinate of DPoint2d.
Definition: DPoint2d.hpp:241
Difference of Point3D class, specialization of DPoint<CoordType,DIM> with DIM = 3.
Container3D::col_iterator col_end(size_type slice, size_type col)
iterator3d_box element assignment operator.
Container3D::row_iterator row_begin(size_type slice, size_type row)
iterator3d_box element assignment operator.
self operator--(int)
Postdecrement a const_iterator3d_box. Iterate to the previous location inside the Box3d...
friend bool operator!=(const self &i1, const self &i2)
Inequality operator.
Container3D::size_type size_type
int x2() const
Access to the first subscript of the current const_iterator3d_box.
self & operator=(const self &o)
Assign a const_iterator3d_box.
Provides a class to tag SLIP iterators.
self operator+(const difference_type &d)
const_iterator3d_box addition.
friend bool operator==(const self &i1, const self &i2)
Equality operator.
DPoint2d< int > diff2d
friend bool operator<=(const self &i1, const self &i2)
<= operator.
Container3D::pointer pointer
Container3D::const_pointer pointer
Provides a class to modelize the difference of slip::Point3d.
self operator++(int)
Postincrement a iterator3d_box. Iterate to the next location inside the Box3d.
Container3D::const_iterator2d plane_bottom_right(const slip::PLANE_ORIENTATION p, const size_type xp)
const_iterator3d_box element assignment operator.
const_iterator3d_box()
Constructs a const_iterator3d_box.
friend bool operator<(const self &i1, const self &i2)
< operator.
Container3D::slice_iterator slice_begin(size_type row, size_type col)
iterator3d_box element assignment operator.
self & operator+=(const difference_type &d)
iterator3d_box addition.
Container3D::const_slice_iterator slice_end(size_type row, size_type col) const
const_iterator3d_box element assignment operator.
friend bool operator!=(const self &i1, const self &i2)
Inequality operator.
int x3() const
Access to the second subscript of the current iterator3d_box.
friend difference_type operator-(const self &i1, const self &i2)
const_iterator3d_box difference operator.
self & operator++()
Preincrement a const_iterator3d_box. Iterate to the next location inside the Box3d.
self & operator++()
Preincrement a iterator3d_box. Iterate to the next location inside the Box3d.
PLANE_ORIENTATION
Choose between different plane orientations.
void dx1(const CoordType &dx)
Accessor of the first coordinate of DPoint2d.
Definition: DPoint2d.hpp:229
self & operator-=(const difference_type &d)
iterator3d_box substraction.
self operator+(const difference_type &d)
iterator3d_box addition.
int k() const
Access to the first subscript of the current iterator3d_box.
void front_upper_left(Point< CoordType, 3 >)
Accessor/Mutator of the front_upper_left point (p1) of Box3d.
Definition: Box3d.hpp:355
friend bool operator<=(const self &i1, const self &i2)
<= operator.
std::random_access_iterator3d_tag iterator_category
Container3D::const_col_iterator col_end(size_t slice, size_type col) const
const_iterator3d_box element assignment operator.
Container3D::reference reference
reference operator[](difference_type d)
iterator3d_box element assignment operator. Equivalent to *(k + d) = t.
Container3D::const_slice_iterator slice_begin(size_type row, size_type col) const
const_iterator3d_box element assignment operator.
Container3D::const_reference reference
Provides a class to manipulate 3d box.
friend bool operator>(const self &i1, const self &i2)
operator.
void dx2(const CoordType &dx)
Accessor of the second coordinate of DPoint3d.
Definition: DPoint3d.hpp:261
Difference of Point2D class, specialization of DPoint<CoordType,DIM> with DIM = 2.
Definition: Array2d.hpp:129
const pointer * operator[](int n) const
iterator3d_box element assignment operator. Equivalent to *(k + n).
self operator-(const difference_type &d)
iterator3d_box substraction.
friend bool operator<(const self &i1, const self &i2)
< operator.
self operator--(int)
Postdecrement a iterator3d_box. Iterate to the previous location inside the Box3d.
reference operator*() const
Dereference operator. Returns the element that the current const_iterator3d_box i point to...
pointer operator->() const
const_iterator3d_box(const self &o)
Constructs a copy of the const_iterator3d_box o.
self operator-(const difference_type &d)
const_iterator3d_box substraction.
Container3D::iterator2d plane_bottom_right(const slip::PLANE_ORIENTATION p, const size_type xp)
iterator3d_box element assignment operator.
Container3D::size_type size_type
iterator3d_box(const self &o)
Constructs a copy of the iterator3d_box o.
int k() const
Access to the first subscript of the current const_iterator3d_box.
reference operator*()
Dereference assignment operator. Returns the element that the current iterator3d_box i point to...
CoordType depth() const
compute the depth of the Box3d.
Definition: Box3d.hpp:416
int x1() const
Access to the first subscript of the current const_iterator3d_box.
Provides a class to iterate 3d containers throw a planes.
This is some iterator to iterate a 3d container into a Box area defined by the subscripts of the 3d c...
friend difference_type operator-(const self &i1, const self &i2)
iterator3d_box difference operator.
pointer * operator[](int n) const
const_iterator3d_box element assignment operator. Equivalent to *(k + n).
int j() const
Access to the second subscript of the current const_iterator3d_box.
Container3D::col_iterator col_begin(size_type slice, size_type col)
iterator3d_box element assignment operator.
void back_bottom_right(Point< CoordType, 3 >)
Accessor/Mutator of the back_bottom_right point (p2) of Box3d.
Definition: Box3d.hpp:368
self & operator--()
Predecrement a const_iterator3d_box. Iterate to the previous location inside the Box3d.
const_iterator3d_box(Container3D *c, const Box3d< int > &b)
Constructs a const_iterator3d_box.
int x2() const
Access to the second subscript of the current iterator3d_box.
int j() const
Access to the second subscript of the current iterator3d_box.
pointer operator[](diff2d d) const
const_iterator3d_box element assignment operator. Equivalent to *(k + d).
self & operator+=(const difference_type &d)
const_iterator3d_box addition.
reference operator[](difference_type d) const
const_iterator3d_box element assignment operator. Equivalent to *(k + d).
iterator3d_box(Container3D *c, const Box3d< int > &b)
Constructs a iterator3d_box.
iterator3d_box()
Constructs a iterator3d_box.
Container3D::slice_iterator slice_end(size_type row, size_type col)
iterator3d_box element assignment operator.
const reference operator*() const
Dereference operator. Returns the element that the current iterator3d_box i point to...
friend bool operator==(const self &i1, const self &i2)
Equality operator.
Container3D::const_iterator2d plane_upper_left(const slip::PLANE_ORIENTATION p, const size_type xp)
const_iterator3d_box element assignment operator.
Container3D::const_row_iterator row_begin(size_t slice, size_type row) const
const_iterator3d_box element assignment operator.
Container3D::iterator2d plane_upper_left(const slip::PLANE_ORIENTATION p, const size_type xp)
iterator3d_box element assignment operator.
pointer operator[](diff2d d)
iterator3d_box element assignment operator. Equivalent to *(k + d) = t.
friend bool operator>=(const self &i1, const self &i2)
>= operator.
int i() const
Access to the first subscript of the current iterator3d_box.
Container3D::value_type value_type
void dx1(const CoordType &dx)
Accessor of the first coordinate of DPoint3d.
Definition: DPoint3d.hpp:249
std::random_access_iterator3d_tag iterator_category
int x1() const
Access to the first subscript of the current iterator3d_box.
CoordType height() const
compute the height of the Box3d.
Definition: Box3d.hpp:412
DPoint3d< int > difference_type
self & operator-=(const difference_type &d)
const_iterator3d_box substraction.
Container3D::row_iterator row_end(size_type slice, size_type row)
iterator3d_box element assignment operator.
This is some iterator to iterate a 3d container into a Box area defined by the subscripts of the 3d c...