bpp-core3  3.0.0
Point2DTools.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: The Bio++ Development Group
2 //
3 // SPDX-License-Identifier: CECILL-2.1
4 
5 #ifndef BPP_GRAPHICS_POINT2DTOOLS_H
6 #define BPP_GRAPHICS_POINT2DTOOLS_H
7 
8 
9 // From local
10 #include "Point2D.h"
11 
12 namespace bpp
13 {
21 {
22 public:
30  template<class T> static double getDistanceBetween(const Point2D<T>& co1, const Point2D<T>& co2)
31  {
32  T base, height;
33  base = co1.getX() - co2.getX();
34  height = co1.getY() - co2.getY();
35  base = base * base;
36  height = height * height;
37  return sqrt((double)base + (double)height);
38  }
39 };
40 } // end of namespace bpp;
41 #endif // BPP_GRAPHICS_POINT2DTOOLS_H
The Point2D class.
Definition: Point2D.h:21
const T & getY() const
Get the latitude.
Definition: Point2D.h:77
const T & getX() const
Get the longitude.
Definition: Point2D.h:72
static double getDistanceBetween(const Point2D< T > &co1, const Point2D< T > &co2)
Get the distance between two Coord objects.
Definition: Point2DTools.h:30
Some functions to deal with Point2D.
Definition: Point2DTools.h:20