Blender V4.3
BLI_math_axis_angle_types.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
5#pragma once
6
23#include <ostream>
24
26#include "BLI_math_base.hh"
29
30namespace blender::math {
31
32template<typename T, typename AngleT> struct AxisAngleBase {
34
35 private:
37 vec3_type axis_ = {0, 1, 0};
38 AngleT angle_ = AngleT::identity();
39
40 public:
41 AxisAngleBase() = default;
42
46 AxisAngleBase(const AxisSigned axis, const AngleT &angle);
47
52 AxisAngleBase(const vec3_type &axis, const AngleT &angle);
53
59 AxisAngleBase(const vec3_type &from, const vec3_type &to);
60
64 {
65 return {};
66 }
67
70 const vec3_type &axis() const
71 {
72 return axis_;
73 }
74
75 const AngleT &angle() const
76 {
77 return angle_;
78 }
79
83
84 friend std::ostream &operator<<(std::ostream &stream, const AxisAngleBase &rot)
85 {
86 return stream << "AxisAngle(axis=" << rot.axis() << ", angle=" << rot.angle() << ")";
87 }
88};
89
92
93} // namespace blender::math
#define BLI_STRUCT_EQUALITY_OPERATORS_2(Type, m1, m2)
#define rot(x, k)