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

implement an orthogonal basis of the tangent spaces for all dimensions (not just 2)

[[Imported from SVN: r6501]]
parent 63e29ab5
No related branches found
No related tags found
No related merge requests found
...@@ -293,12 +293,38 @@ public: ...@@ -293,12 +293,38 @@ public:
Dune::FieldMatrix<double,N-1,N> orthonormalFrame() const { Dune::FieldMatrix<double,N-1,N> orthonormalFrame() const {
Dune::FieldMatrix<double,N-1,N> result; Dune::FieldMatrix<double,N-1,N> result;
// Coordinates of the stereographic projection
Dune::FieldVector<double,N-1> X;
if (N==2) { if (data_[N-1] <= 0) {
result[0][0] = -data_[1];
result[0][1] = data_[0]; // Stereographic projection from the north pole onto R^{N-1}
} else for (size_t i=0; i<N-1; i++)
DUNE_THROW(Dune::NotImplemented, "orthonormalFrame for N!=2!"); X[i] = data_[i] / (1-data_[N-1]);
} else {
// Stereographic projection from the south pole onto R^{N-1}
for (size_t i=0; i<N-1; i++)
X[i] = data_[i] / (1+data_[N-1]);
}
double RSquared = X.two_norm2();
for (size_t i=0; i<N-1; i++)
for (size_t j=0; j<N-1; j++)
// Note: the matrix is the transpose of the one in the paper
result[j][i] = 2*(i==j)*(1+RSquared) - 4*X[i]*X[j];
for (size_t j=0; j<N-1; j++)
result[j][N-1] = 4*X[j];
// Upper hemisphere: adapt formulas so it is the stereographic projection from the south pole
if (data_[N-1] > 0)
for (size_t j=0; j<N-1; j++)
result[j][N-1] *= -1;
return result; return result;
} }
......
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