Skip to content
Snippets Groups Projects
Commit 3882e921 authored by Oliver Sander's avatar Oliver Sander Committed by sander@PCPOOL.MI.FU-BERLIN.DE
Browse files

implement the distance metric

[[Imported from SVN: r5526]]
parent 7508ec1b
No related branches found
No related tags found
No related merge requests found
......@@ -17,6 +17,8 @@ public:
typedef Dune::FieldVector<double,N> EmbeddedTangentVector;
typedef Dune::FieldVector<double,N> TangentVector;
/** \brief Default constructor */
RealTuple()
{}
......@@ -26,6 +28,17 @@ public:
{
data_.assign(v);
}
/** \brief Geodesic distance between two points
Simply the Euclidean distance */
static double distance(const RealTuple& a, const RealTuple& b) {
double result = 0;
for (int i=0; i<N; i++)
result += (a.data_[0] - b.data_[0]) * (a.data_[0] - b.data_[0]);
return std::sqrt(result);
}
/** \brief Write LocalKey object to output stream */
friend std::ostream& operator<< (std::ostream& s, const RealTuple& realTuple)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment