bpp-core  2.2.0
Point2DTools.h
Go to the documentation of this file.
1 //
2 // File Point2DTools.h (from CoordsTools.h)
3 // Author : Sylvain Gaillard
4 //
5 
6 /*
7  Copyright or © or Copr. CNRS, (November 17, 2004)
8 
9  This software is a computer program whose purpose is to provide classes
10  for population genetics analysis.
11 
12  This software is governed by the CeCILL license under French law and
13  abiding by the rules of distribution of free software. You can use,
14  modify and/ or redistribute the software under the terms of the CeCILL
15  license as circulated by CEA, CNRS and INRIA at the following URL
16  "http://www.cecill.info".
17 
18  As a counterpart to the access to the source code and rights to copy,
19  modify and redistribute granted by the license, users are provided only
20  with a limited warranty and the software's author, the holder of the
21  economic rights, and the successive licensors have only limited
22  liability.
23 
24  In this respect, the user's attention is drawn to the risks associated
25  with loading, using, modifying and/or developing or reproducing the
26  software by the user in light of its specific status of free software,
27  that may mean that it is complicated to manipulate, and that also
28  therefore means that it is reserved for developers and experienced
29  professionals having in-depth computer knowledge. Users are therefore
30  encouraged to load and test the software's suitability as regards their
31  requirements in conditions enabling the security of their systems and/or
32  data to be ensured and, more generally, to use and operate it in the
33  same conditions as regards security.
34 
35  The fact that you are presently reading this means that you have had
36  knowledge of the CeCILL license and that you accept its terms.
37  */
38 
39 #ifndef _POINT2DTOOLS_H_
40 #define _POINT2DTOOLS_H_
41 
42 // From local
43 #include "Point2D.h"
44 
45 namespace bpp
46 {
47 
55  {
56  public:
64  template<class T> static double getDistanceBetween(const Point2D<T>& co1, const Point2D<T>& co2)
65  {
66  T base, height;
67  base = co1.getX() - co2.getX();
68  height = co1.getY() - co2.getY();
69  base = base * base;
70  height = height * height;
71  return sqrt((double)base + (double)height);
72  }
73 
74  };
75 
76 } //end of namespace bpp;
77 
78 #endif // _POINT2DTOOLS_H_
79 
The Point2D class.
Definition: Point2D.h:56
This class allows to perform a correspondence analysis.
const T & getY() const
Get the latitude.
Definition: Point2D.h:110
const T & getX() const
Get the longitude.
Definition: Point2D.h:105
static double getDistanceBetween(const Point2D< T > &co1, const Point2D< T > &co2)
Get the distance between two Coord objects.
Definition: Point2DTools.h:64
Some functions to deal with Point2D.
Definition: Point2DTools.h:54