// Tangent vector to the unit sphere along the geodesic given by e1 and e2.
Tensor<1,spacedim> tg = (e2-(e2*e1)*e1);
- // There is a special case if e2*e1, in which case tg=0
+ // There is a special case if e2*e1==1.0, in which case tg==0
const double tg_norm = tg.norm();
- if (tg_norm > tolerance)
+ if (tg_norm < tolerance)
+ return p2-p1;
+ else
tg /= tg_norm;
const double gamma = std::acos(e1*e2);
--- /dev/null
+// ---------------------------------------------------------------------
+//
+// Copyright (C) 2017 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+// test tangent vectors for linear dependent positions
+
+#include "../tests.h"
+
+#include <deal.II/base/utilities.h>
+#include <deal.II/grid/manifold_lib.h>
+
+
+int
+main()
+{
+ initlog();
+
+ const SphericalManifold<2> manifold_2;
+ const SphericalManifold<3> manifold_3;
+
+ // get tangent vectors for positions that are on a line as seen from the center
+ deallog << manifold_2.get_tangent_vector (Point<2>(0.5, 0),
+ Point<2>(1.0, 0)) << std::endl
+ << manifold_3.get_tangent_vector (Point<3>(0, 0, -0.5),
+ Point<3>(0, 0, -1.0)) << std::endl;
+}