Blender
V4.5
source
blender
blenlib
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
25
#include "
BLI_math_angle_types.hh
"
26
#include "
BLI_math_basis_types.hh
"
27
#include "
BLI_math_vector_types.hh
"
28
29
namespace
blender::math
{
30
31
template
<
typename
T,
typename
AngleT>
struct
AxisAngleBase
{
32
using
vec3_type
=
VecBase<T, 3>
;
33
34
private
:
36
vec3_type
axis_ = {0, 1, 0};
37
AngleT angle_ = AngleT::identity();
38
39
public
:
40
AxisAngleBase
() =
default
;
41
45
AxisAngleBase
(
const
AxisSigned
axis
,
const
AngleT &
angle
);
46
51
AxisAngleBase
(
const
vec3_type
&
axis
,
const
AngleT &
angle
);
52
58
AxisAngleBase
(
const
vec3_type
&
from
,
const
vec3_type
&to);
59
62
static
AxisAngleBase
identity
()
63
{
64
return
{};
65
}
66
69
const
vec3_type
&
axis
()
const
70
{
71
return
axis_;
72
}
73
74
const
AngleT &
angle
()
const
75
{
76
return
angle_;
77
}
78
81
BLI_STRUCT_EQUALITY_OPERATORS_2
(
AxisAngleBase
, axis_, angle_)
82
83
friend std::ostream &operator<<(std::ostream &stream, const
AxisAngleBase
&
rot
)
84
{
85
return
stream <<
"AxisAngle(axis="
<<
rot
.axis() <<
", angle="
<<
rot
.angle() <<
")"
;
86
}
87
};
88
89
using
AxisAngle
=
AxisAngleBase<float, AngleRadianBase<float>
>;
90
using
AxisAngleCartesian
=
AxisAngleBase<float, AngleCartesianBase<float>
>;
91
92
}
// namespace blender::math
BLI_math_angle_types.hh
BLI_math_basis_types.hh
BLI_math_vector_types.hh
BLI_STRUCT_EQUALITY_OPERATORS_2
#define BLI_STRUCT_EQUALITY_OPERATORS_2(Type, m1, m2)
Definition
BLI_struct_equality_utils.hh:33
blender::math::AxisSigned
Definition
BLI_math_basis_types.hh:101
from
StackEntry * from
Definition
deg_builder_cycle.cc:39
rot
#define rot(x, k)
blender::math
Definition
BLI_math_angle_types.hh:25
blender::VecBase< T, 3 >
blender::math::AxisAngleBase
Definition
BLI_math_axis_angle_types.hh:31
blender::math::AxisAngleBase::AxisAngleBase
AxisAngleBase()=default
blender::math::AxisAngleBase::identity
static AxisAngleBase identity()
Definition
BLI_math_axis_angle_types.hh:62
blender::math::AxisAngleBase::angle
const AngleT & angle() const
Definition
BLI_math_axis_angle_types.hh:74
blender::math::AxisAngleBase::axis
const vec3_type & axis() const
Definition
BLI_math_axis_angle_types.hh:69
Generated on Fri Apr 3 2026 06:33:18 for Blender by
doxygen
1.11.0