SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Point4d.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 
73 #ifndef SLIP_POINT4D_HPP
74 #define SLIP_POINT4D_HPP
75 
76 #include <iostream>
77 #include <cassert>
78 #include <string>
79 #include "Point.hpp"
80 
81 #include <boost/serialization/access.hpp>
82 #include <boost/serialization/split_member.hpp>
83 #include <boost/serialization/version.hpp>
84 #include <boost/serialization/base_object.hpp>
85 
86 namespace slip
87 {
101 template <typename CoordType>
102 class Point4d:public slip::Point<CoordType,4>
103 {
104 public :
105  typedef Point4d<CoordType> self;
107 
112 
116  Point4d();
117 
122  Point4d(const CoordType* array);
123 
131  Point4d(const CoordType& x1,
132  const CoordType& x2,
133  const CoordType& x3,
134  const CoordType& x4);
135 
146  void x1(const CoordType& x);
151  CoordType& x1();
156  const CoordType& x1()const;
157 
162  void x2(const CoordType& x);
163 
168  CoordType& x2();
169 
174  const CoordType& x2() const;
175 
180  void x3(const CoordType& x);
181 
186  CoordType& x3();
191  const CoordType& x3() const;
192 
197  void x4(const CoordType& x);
198 
203  CoordType& x4();
208  const CoordType& x4() const;
209 
216  std::string name() const;
217 
228  self& operator=(const base & p){
229  this->coord_[0] = p[0];
230  this->coord_[1] = p[1];
231  this->coord_[2] = p[2];
232  this->coord_[3] = p[3];
233  return (*this);
234  }
237  private:
239  template<class Archive>
240  void save(Archive & ar, const unsigned int version) const
241  {
242  ar & boost::serialization::base_object<slip::Point<CoordType,4> >(*this);
243  }
244  template<class Archive>
245  void load(Archive & ar, const unsigned int version)
246  {
247  ar & boost::serialization::base_object<slip::Point<CoordType,4> >(*this);
248  }
249  BOOST_SERIALIZATION_SPLIT_MEMBER()
250 
251 };
272 }//slip::
273 
274 namespace slip
275 {
276 template<typename CoordType>
277 inline
279 {
280  this->coord_[0] = CoordType(0);
281  this->coord_[1] = CoordType(0);
282  this->coord_[2] = CoordType(0);
283  this->coord_[3] = CoordType(0);
284 }
285 
286 template<typename CoordType>
287 inline
288 Point4d<CoordType>::Point4d(const CoordType* array):
289 slip::Point<CoordType,4>(array)
290 {}
291 
292 
293 template<typename CoordType>
294 inline
296  const CoordType& x1, const CoordType& x2,
297  const CoordType& x3, const CoordType& x4)
298  {
299  this->coord_[0] = CoordType(x1);
300  this->coord_[1] = CoordType(x2);
301  this->coord_[2] = CoordType(x3);
302  this->coord_[3] = CoordType(x4);
303  }
304 
305 template<typename CoordType>
306 inline
307 CoordType& Point4d<CoordType>::x1() {return this->coord_[0];}
308 
309 template<typename CoordType>
310 inline
311 const CoordType& Point4d<CoordType>::x1() const {return this->coord_[0];}
312 
313 template<typename CoordType>
314 inline
315 CoordType& Point4d<CoordType>::x2() {return this->coord_[1];}
316 
317 template<typename CoordType>
318 inline
319 const CoordType& Point4d<CoordType>::x2() const {return this->coord_[1];}
320 
321 
322 template<typename CoordType>
323 inline
324 CoordType& Point4d<CoordType>::x3() {return this->coord_[2];}
325 
326 template<typename CoordType>
327 inline
328 const CoordType& Point4d<CoordType>::x3() const {return this->coord_[2];}
329 
330 template<typename CoordType>
331 inline
332 CoordType& Point4d<CoordType>::x4() {return this->coord_[3];}
333 
334 template<typename CoordType>
335 inline
336 const CoordType& Point4d<CoordType>::x4() const {return this->coord_[3];}
337 
338 template<typename CoordType>
339 inline
340 void Point4d<CoordType>::x1(const CoordType& x1) {this->coord_[0]=x1;}
341 
342 template<typename CoordType>
343 inline
344 void Point4d<CoordType>::x2(const CoordType& x2) {this->coord_[1]=x2;}
345 
346 template<typename CoordType>
347 inline
348 void Point4d<CoordType>::x3(const CoordType& x3) {this->coord_[2]=x3;}
349 
350 template<typename CoordType>
351 inline
352 void Point4d<CoordType>::x4(const CoordType& x4) {this->coord_[3]=x4;}
353 
354 template<typename CoordType>
355 inline
356 std::string
357 Point4d<CoordType>::name() const {return "Point4d";}
358 
359 }//slip::
360 
361 #endif //SLIP_POINT4D_HPP
slip::Point4d< int > Point4d_i
int alias
Definition: Point4d.hpp:265
std::string name() const
Returns the name of the class.
Definition: Point4d.hpp:357
slip::Point4d< short > Point4d_s
short alias
Definition: Point4d.hpp:261
slip::Point4d< unsigned char > Point4d_uc
unsigned char alias
Definition: Point4d.hpp:271
block< value_type, DIM > coord_
The coordinates of the point are stored in this block.
Definition: Point.hpp:347
CoordType & x1()
Accessor/Mutator of the first coordinate of Point4d.
Definition: Point4d.hpp:307
Provides an abstract class to modelize nd points.
Define an abstract Point structure.
Definition: Box.hpp:92
slip::Point4d< unsigned long > Point4d_ul
unsigned long alias
Definition: Point4d.hpp:259
slip::Point4d< float > Point4d_f
float alias
Definition: Point4d.hpp:255
CoordType & x2()
Accessor/Mutator of the second coordinate of Point4d.
Definition: Point4d.hpp:315
This is a point4d class, a specialized version of Point<CoordType,DIM> with DIM = 4...
slip::Point4d< unsigned int > Point4d_ui
unsigned int alias
Definition: Point4d.hpp:267
CoordType & x3()
Accessor/Mutator of the third coordinate of Point4d.
Definition: Point4d.hpp:324
slip::Point4d< char > Point4d_c
char alias
Definition: Point4d.hpp:269
self & operator=(const base &p)
Assign a Point. Assign elements of Point in a Point4d.
Definition: Point4d.hpp:228
slip::Point4d< unsigned short > Point4d_us
unsigned long alias
Definition: Point4d.hpp:263
Point4d()
Constructs a Point4d.
Definition: Point4d.hpp:278
friend class boost::serialization::access
Definition: Point4d.hpp:238
slip::Point< CoordType, 4 > base
Definition: Point4d.hpp:106
slip::Point4d< double > Point4d_d
double alias
Definition: Point4d.hpp:253
slip::Point4d< long > Point4d_l
long alias
Definition: Point4d.hpp:257
CoordType & x4()
Accessor/Mutator of the fourth coordinate of Point4d.
Definition: Point4d.hpp:332