9#include <boost/python/class.hpp>
10#include <boost/python/copy_const_reference.hpp>
11#include <boost/python/operators.hpp>
12#include <boost/python/register_ptr_to_python.hpp>
13#include <boost/python/return_arg.hpp>
14#include <boost/python/return_value_policy.hpp>
16using boost::python::arg;
17using boost::python::class_;
18using boost::python::copy_const_reference;
19using boost::python::init;
20using boost::python::return_value_policy;
28 boost::python::register_ptr_to_python<std::shared_ptr<Quat>>();
32 "Quaternions are the 3D generalization of complex numbers. "
33 "Quaternions are used for roations in 3D spaces and often "
35 "computer graphics applications.",
36 init<>(arg(
"self"),
"Construct a default Quat that will perform no transformation."))
37 .def(init<double, double, double, double>((arg(
"self"), arg(
"w"), arg(
"a"), arg(
"b"), arg(
"c")),
38 "Constructor with values"))
39 .def(init<V3D, V3D>((arg(
"self"), arg(
"src"), arg(
"dest")),
"Construct a Quat between two vectors"))
40 .def(init<V3D, V3D, V3D>((arg(
"self"), arg(
"rX"), arg(
"rY"), arg(
"rZ")),
41 "Construct a Quaternion that performs a "
42 "reference frame rotation.\nThe initial X,Y,Z "
43 "vectors are aligned as expected: X=(1,0,0), "
44 "Y=(0,1,0), Z=(0,0,1)"))
45 .def(init<double, V3D>((arg(
"self"), arg(
"deg"), arg(
"axis")),
"Constructor from an angle(degrees) and an axis."))
46 .def(
"rotate", &
Quat::rotate, (arg(
"self"), arg(
"v")),
"Rotate the quaternion by the given vector")
47 .def(
"real", &
Quat::real, arg(
"self"),
"Returns the real part of the quaternion")
48 .def(
"imagI", &
Quat::imagI, arg(
"self"),
"Returns the ith imaginary component")
49 .def(
"imagJ", &
Quat::imagJ, arg(
"self"),
"Returns the jth imaginary component")
50 .def(
"imagK", &
Quat::imagK, arg(
"self"),
"Returns the kth imaginary component")
51 .def(
"len", &
Quat::len, arg(
"self"),
"Returns the 'length' of the quaternion")
52 .def(
"len2", &
Quat::len2, arg(
"self"),
"Returns the square of the 'length' of the quaternion")
54 "Default convention is \'YZX\'.")
55 .def(
"__add__", &Quat::operator+, (arg(
"left"), arg(
"right")))
56 .def(
"__iadd__", &Quat::operator+=, boost::python::return_self<>(), (arg(
"self"), arg(
"other")))
57 .def(
"__sub__", &Quat::operator-, (arg(
"left"), arg(
"right")))
58 .def(
"__isub__", &Quat::operator-=, boost::python::return_self<>(), (arg(
"self"), arg(
"other")))
59 .def(
"__mul__", &Quat::operator*, (arg(
"left"), arg(
"right")))
60 .def(
"__imul__", &Quat::operator*=, boost::python::return_self<>(), (arg(
"self"), arg(
"other")))
61 .def(
"__eq__", &Quat::operator==, (arg(
"self"), arg(
"other")))
62 .def(
"__ne__", &Quat::operator!=, (arg(
"self"), arg(
"other")))
63 .def(
"__getitem__", (
double (
Quat::*)(
int)
const) & Quat::operator[], (arg(
"self"), arg(
"index")))
void export_Quat()
Python exports of the Mantid::Kernel::Quat class.
double len() const
Norm of a quaternion.
double imagJ() const
Access the coefficient of j.
double len2() const
Norm squared.
double real() const
Access the real part.
void rotate(V3D &) const
Rotate a vector.
std::string toString() const
std::vector< double > getEulerAngles(const std::string &convention) const
Calculate the Euler angles that are equivalent to this Quaternion.
double imagI() const
Access the coefficient of i.
double imagK() const
Access the coefficient of k.