Mantid
Loading...
Searching...
No Matches
EigenConversionHelpers.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2017 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7#pragma once
8
9#include "MantidKernel/DllConfig.h"
10#include "MantidKernel/Quat.h"
11#include "MantidKernel/V3D.h"
12
13#include <Eigen/Geometry>
14
15namespace Mantid {
16namespace Kernel {
17
26inline Kernel::V3D toV3D(const Eigen::Vector3d &vec) { return Kernel::V3D(vec[0], vec[1], vec[2]); }
27
29inline Kernel::Quat toQuat(const Eigen::Quaterniond &quat) {
30 return Kernel::Quat(quat.w(), quat.x(), quat.y(), quat.z());
31}
32
34inline Eigen::Vector3d toVector3d(const Kernel::V3D &vec) { return Eigen::Vector3d(vec[0], vec[1], vec[2]); }
35
37inline Eigen::Quaterniond toQuaterniond(const Kernel::Quat &quat) {
38 return Eigen::Quaterniond(quat.real(), quat.imagI(), quat.imagJ(), quat.imagK());
39}
40
41} // namespace Kernel
42} // namespace Mantid
Class for quaternions.
Definition: Quat.h:39
double imagJ() const
Access the coefficient of j.
Definition: Quat.h:121
double real() const
Access the real part.
Definition: Quat.h:117
double imagI() const
Access the coefficient of i.
Definition: Quat.h:119
double imagK() const
Access the coefficient of k.
Definition: Quat.h:123
Class for 3D vectors.
Definition: V3D.h:34
Kernel::Quat toQuat(const Eigen::Quaterniond &quat)
Converts Eigen::Quaterniond to Kernel::Quat.
Eigen::Vector3d toVector3d(const Kernel::V3D &vec)
Converts Kernel::V3D to Eigen::Vector3d.
Kernel::V3D toV3D(const Eigen::Vector3d &vec)
This header provides conversion helpers between vector and rotation types in MantidKernel and equival...
Eigen::Quaterniond toQuaterniond(const Kernel::Quat &quat)
Converts Kernel::Quat to Eigen::Quaterniond.
Helper class which provides the Collimation Length for SANS instruments.