OGS
Point3d.h
Go to the documentation of this file.
1
13 #pragma once
14
15 #include <limits>
16 #include <Eigen/Dense>
17
18 #include "mathlib_export.h"
19
20 #include "TemplatePoint.h"
21
22 namespace MathLib
23 {
25
33 template <typename MATRIX>
34 inline MathLib::Point3d operator*(MATRIX const& mat, MathLib::Point3d const& p)
35 {
36  MathLib::Point3d new_p;
37  for (std::size_t i(0); i<3; ++i) {
38  for (std::size_t j(0); j<3; ++j) {
39  new_p[i] += mat(i,j)*p[j];
40  }
41  }
42  return new_p;
43 }
44
47 inline
48 double sqrDist(MathLib::Point3d const& p0, MathLib::Point3d const& p1)
49 {
50  return (Eigen::Map<Eigen::Vector3d>(const_cast<double*>(p0.getCoords())) -
51  Eigen::Map<Eigen::Vector3d>(const_cast<double*>(p1.getCoords())))
52  .squaredNorm();
53 }
54
57 inline
58 double sqrDist2d(MathLib::Point3d const& p0, MathLib::Point3d const& p1)
59 {
60  return (p0[0]-p1[0])*(p0[0]-p1[0]) + (p0[1]-p1[1])*(p0[1]-p1[1]);
61 }
62
63 } // end namespace MathLib
Definition of the TemplatePoint class.
const T * getCoords() const
Definition: TemplatePoint.h:75
#define MATHLIB_EXPORT
MathLib::TemplatePoint< double, 3 > Point3d
static const double p
double sqrDist2d(MathLib::Point3d const &p0, MathLib::Point3d const &p1)
Definition: Point3d.h:58
MathLib::Point3d operator*(MATRIX const &mat, MathLib::Point3d const &p)
Definition: Point3d.h:34
double sqrDist(MathLib::Point3d const &p0, MathLib::Point3d const &p1)
Definition: Point3d.h:48
const Point3d ORIGIN
Definition: Point3d.h:26