SLIP  1.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Point2d.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 
74 #ifndef SLIP_POINT2D_HPP
75 #define SLIP_POINT2D_HPP
76 
77 #include <iostream>
78 #include <cassert>
79 #include <string>
80 #include "Point.hpp"
81 
82 #include <boost/serialization/access.hpp>
83 #include <boost/serialization/split_member.hpp>
84 #include <boost/serialization/version.hpp>
85 #include <boost/serialization/base_object.hpp>
86 
87 namespace slip
88 {
107 template <typename CoordType>
108 class Point2d:public Point<CoordType,2>
109 {
110 public :
111  typedef Point2d<CoordType> self;
113 
118 
122  Point2d();
123 
128  Point2d(const CoordType* array);
129 
135  Point2d(const CoordType& x1,
136  const CoordType& x2);
137 
149  void x1(const CoordType& x);
150 
155  CoordType& x1();
156 
161  const CoordType& x1() const;
162 
167  void x2(const CoordType& x);
168 
173  CoordType& x2();
174 
179  const CoordType& x2() const;
186  std::string name() const;
187 private:
188  friend class boost::serialization::access;
189  template<class Archive>
190  void save(Archive & ar, const unsigned int version) const
191  {
192  ar & boost::serialization::base_object<slip::Point<CoordType,2> >(*this);
193  }
194  template<class Archive>
195  void load(Archive & ar, const unsigned int version)
196  {
197  ar & boost::serialization::base_object<slip::Point<CoordType,2> >(*this);
198  }
199  BOOST_SERIALIZATION_SPLIT_MEMBER()
200 };
221 }//slip::
222 
223 namespace slip
224 {
225  template<typename CoordType>
226  inline
228  {
229  this->coord_[0] = CoordType(0);
230  this->coord_[1] = CoordType(0);
231  }
232 
233  template<typename CoordType>
234  inline
235  Point2d<CoordType>::Point2d(const CoordType* array):
236  Point<CoordType,2>(array)
237  {}
238 
239  template<typename CoordType>
240  inline
241  Point2d<CoordType>::Point2d(const CoordType& x1,
242  const CoordType& x2)
243  {
244  this->coord_[0] = CoordType(x1);
245  this->coord_[1] = CoordType(x2);
246  }
247 
248  template<typename CoordType>
249  inline
250  void Point2d<CoordType>::x1(const CoordType& x1) {this->coord_[0]=x1;}
251 
252  template<typename CoordType>
253  inline
254  CoordType& Point2d<CoordType>::x1() {return this->coord_[0];}
255 
256  template<typename CoordType>
257  inline
258  const CoordType& Point2d<CoordType>::x1() const {return this->coord_[0];}
259 
260  template<typename CoordType>
261  inline
262  void Point2d<CoordType>::x2(const CoordType& x2) {this->coord_[1]=x2;}
263 
264 
265  template<typename CoordType>
266  inline
267  CoordType& Point2d<CoordType>::x2() {return this->coord_[1];}
268 
269  template<typename CoordType>
270  inline
271  const CoordType& Point2d<CoordType>::x2() const {return this->coord_[1];}
272 
273  template<typename CoordType>
274  inline
275  std::string
276  Point2d<CoordType>::name() const {return "Point2d";}
277 
278 }//slip::
279 
280 #endif //SLIP_POINT2D_HPP
slip::Point2d< unsigned char > Point2d_uc
unsigned char alias
Definition: Point2d.hpp:220
CoordType & x2()
Accessor/Mutator of the second coordinate of Point2d.
Definition: Point2d.hpp:267
slip::Point2d< float > Point2d_f
float alias
Definition: Point2d.hpp:204
slip::Point2d< short > Point2d_s
short alias
Definition: Point2d.hpp:210
slip::Point2d< unsigned long > Point2d_ul
unsigned long alias
Definition: Point2d.hpp:208
Provides an abstract class to modelize nd points.
slip::Point2d< char > Point2d_c
char alias
Definition: Point2d.hpp:218
This is a point2d class, a specialized version of Point<CoordType,DIM> with DIM = 2...
Definition: Array2d.hpp:132
slip::Point2d< unsigned short > Point2d_us
unsigned long alias
Definition: Point2d.hpp:212
CoordType & x1()
Accessor/Mutator of the first coordinate of Point2d.
Definition: Point2d.hpp:254
std::string name() const
Returns the name of the class.
Definition: Point2d.hpp:276
Point2d()
Constructs a Point2d.
Definition: Point2d.hpp:227
slip::Point2d< int > Point2d_i
int alias
Definition: Point2d.hpp:214
Point< CoordType, 2 > base
Definition: Point2d.hpp:112
slip::Point2d< unsigned int > Point2d_ui
unsigned int alias
Definition: Point2d.hpp:216
slip::Point2d< long > Point2d_l
long alias
Definition: Point2d.hpp:206
slip::Point2d< double > Point2d_d
double alias
Definition: Point2d.hpp:202