From fb12a894f9e0c1b243f301cce73df476ab2eb4cc Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Fri, 3 Aug 2007 13:55:47 +0000 Subject: [PATCH] compute the difference between to rods on the configuration tangent space of on of them [[Imported from SVN: r1469]] --- src/roddifference.hh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/roddifference.hh diff --git a/src/roddifference.hh b/src/roddifference.hh new file mode 100644 index 00000000..ab32cb6f --- /dev/null +++ b/src/roddifference.hh @@ -0,0 +1,30 @@ +#ifndef ROD_DIFFERENCE_HH +#define ROD_DIFFERENCE_HH + +Dune::BlockVector<Dune::FieldVector<double,6> > computeRodDifference(const std::vector<Configuration>& a, + const std::vector<Configuration>& b) +{ + if (a.size() != b.size()) + DUNE_THROW(Dune::Exception, "a and b have to have the same length!"); + + Dune::BlockVector<Dune::FieldVector<double,6> > result(a.size()); + + for (size_t i=0; i<result.size(); i++) { + + // Subtract centerline position + for (int j=0; j<3; j++) + result[i][j] = a[i].r[j] - b[i].r[j]; + + // Subtract orientations on the tangent space of 'a' + Dune::FieldVector<double,3> v = Quaternion<double>::difference(a[i].q, b[i].q); + + // Compute difference on T_a SO(3) + for (int j=0; j<3; j++) + result[i][j+3] = v[j]; + + } + + return result; +} + +#endif -- GitLab