Code-Eli  0.3.6
distance.hpp
Go to the documentation of this file.
1 /*********************************************************************************
2 * Copyright (c) 2013 David D. Marshall <ddmarsha@calpoly.edu>
3 *
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
8 *
9 * Contributors:
10 * David D. Marshall - initial code and implementation
11 ********************************************************************************/
12 
13 #ifndef eli_geom_point_distance
14 #define eli_geom_point_distance
15 
16 #include <cmath>
17 
18 #include "eli/code_eli.hpp"
19 
20 namespace eli
21 {
22  namespace geom
23  {
24  namespace point
25  {
26  template<typename Derived1__, typename Derived2__>
27  typename Derived1__::Scalar distance2(const Eigen::MatrixBase<Derived1__> &p1, const Eigen::MatrixBase<Derived2__> &p2)
28  {
29  return (p1-p2).squaredNorm();
30  }
31 
32  template<typename Derived1__, typename Derived2__>
33  typename Derived1__::Scalar distance(const Eigen::MatrixBase<Derived1__> &p1, const Eigen::MatrixBase<Derived2__> &p2)
34  {
35  return (p1-p2).norm();
36  }
37  }
38  }
39 }
40 #endif
Definition: math.hpp:20
Derived1__::Scalar distance(const Eigen::MatrixBase< Derived1__ > &p1, const Eigen::MatrixBase< Derived2__ > &p2)
Definition: distance.hpp:33
Derived1__::Scalar distance2(const Eigen::MatrixBase< Derived1__ > &p1, const Eigen::MatrixBase< Derived2__ > &p2)
Definition: distance.hpp:27