SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Point3d.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 
72 #ifndef SLIP_POINT3D_HPP
73 #define SLIP_POINT3D_HPP
74 
75 #include <iostream>
76 #include <cassert>
77 #include <string>
78 #include "Point.hpp"
79 
80 #include <boost/serialization/access.hpp>
81 #include <boost/serialization/split_member.hpp>
82 #include <boost/serialization/version.hpp>
83 #include <boost/serialization/base_object.hpp>
84 
85 namespace slip
86 {
97 template <typename CoordType>
98 class Point3d:public Point<CoordType,3>
99 {
100 public :
101  typedef Point3d<CoordType> self;
103 
108 
112  Point3d();
113 
118  Point3d(const CoordType* array);
119 
126  Point3d(const CoordType& x1,
127  const CoordType& x2,
128  const CoordType& x3);
129 
140  void x1(const CoordType& x);
145  CoordType& x1();
150  const CoordType& x1()const;
151 
156  void x2(const CoordType& x);
157 
162  CoordType& x2();
163 
168  const CoordType& x2() const;
169 
174  void x3(const CoordType& x);
175 
180  CoordType& x3();
185  const CoordType& x3() const;
192  std::string name() const;
193  private:
194  friend class boost::serialization::access;
195  template<class Archive>
196  void save(Archive & ar, const unsigned int version) const
197  {
198  ar & boost::serialization::base_object<slip::Point<CoordType,3> >(*this);
199  }
200  template<class Archive>
201  void load(Archive & ar, const unsigned int version)
202  {
203  ar & boost::serialization::base_object<slip::Point<CoordType,3> >(*this);
204  }
205  BOOST_SERIALIZATION_SPLIT_MEMBER()
206 };
227 }//slip::
228 
229 namespace slip
230 {
231  template<typename CoordType>
232  inline
234  {
235  this->coord_[0] = CoordType(0);
236  this->coord_[1] = CoordType(0);
237  this->coord_[2] = CoordType(0);
238  }
239 
240  template<typename CoordType>
241  inline
242  Point3d<CoordType>::Point3d(const CoordType* array):
243  Point<CoordType,3>(array)
244  {}
245 
246 
247  template<typename CoordType>
248  inline
249  Point3d<CoordType>::Point3d(const CoordType& x1,
250  const CoordType& x2,
251  const CoordType& x3)
252  {
253  this->coord_[0] = CoordType(x1);
254  this->coord_[1] = CoordType(x2);
255  this->coord_[2] = CoordType(x3);
256  }
257 
258  template<typename CoordType>
259  inline
260  CoordType& Point3d<CoordType>::x1() {return this->coord_[0];}
261 
262  template<typename CoordType>
263  inline
264  const CoordType& Point3d<CoordType>::x1() const {return this->coord_[0];}
265 
266  template<typename CoordType>
267  inline
268  CoordType& Point3d<CoordType>::x2() {return this->coord_[1];}
269 
270  template<typename CoordType>
271  inline
272  const CoordType& Point3d<CoordType>::x2() const {return this->coord_[1];}
273 
274 
275  template<typename CoordType>
276  inline
277  CoordType& Point3d<CoordType>::x3() {return this->coord_[2];}
278 
279  template<typename CoordType>
280  inline
281  const CoordType& Point3d<CoordType>::x3() const {return this->coord_[2];}
282 
283  template<typename CoordType>
284  inline
285  void Point3d<CoordType>::x1(const CoordType& x1) {this->coord_[0]=x1;}
286 
287  template<typename CoordType>
288  inline
289  void Point3d<CoordType>::x2(const CoordType& x2) {this->coord_[1]=x2;}
290 
291  template<typename CoordType>
292  inline
293  void Point3d<CoordType>::x3(const CoordType& x3) {this->coord_[2]=x3;}
294 
295  template<typename CoordType>
296  inline
297  std::string
298  Point3d<CoordType>::name() const {return "Point3d";}
299 
300 
301 
302 }//slip::
303 
304 #endif //SLIP_POINT3D_HPP
CoordType & x2()
Accessor/Mutator of the second coordinate of Point3d.
Definition: Point3d.hpp:268
Point< CoordType, 3 > base
Definition: Point3d.hpp:102
slip::Point3d< int > Point3d_i
int alias
Definition: Point3d.hpp:220
CoordType & x3()
Accessor/Mutator of the second coordinate of Point3d.
Definition: Point3d.hpp:277
slip::Point3d< unsigned int > Point3d_ui
unsigned int alias
Definition: Point3d.hpp:222
Provides an abstract class to modelize nd points.
slip::Point3d< double > Point3d_d
double alias
Definition: Point3d.hpp:208
slip::Point3d< unsigned char > Point3d_uc
unsigned char alias
Definition: Point3d.hpp:226
slip::Point3d< short > Point3d_s
short alias
Definition: Point3d.hpp:216
slip::Point3d< unsigned long > Point3d_ul
unsigned long alias
Definition: Point3d.hpp:214
slip::Point3d< float > Point3d_f
float alias
Definition: Point3d.hpp:210
CoordType & x1()
Accessor/Mutator of the first coordinate of Point3d.
Definition: Point3d.hpp:260
std::string name() const
Returns the name of the class.
Definition: Point3d.hpp:298
slip::Point3d< long > Point3d_l
long alias
Definition: Point3d.hpp:212
slip::Point3d< unsigned short > Point3d_us
unsigned long alias
Definition: Point3d.hpp:218
slip::Point3d< char > Point3d_c
char alias
Definition: Point3d.hpp:224
Point3d()
Constructs a Point3d.
Definition: Point3d.hpp:233
This is a point3d class, a specialized version of Point<CoordType,DIM> with DIM = 3...