Blender
V4.3
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_base.hh
"
27
#include "
BLI_math_basis_types.hh
"
28
#include "
BLI_math_vector_types.hh
"
29
30
namespace
blender::math
{
31
32
template
<
typename
T,
typename
AngleT>
struct
AxisAngleBase
{
33
using
vec3_type
=
VecBase<T, 3>
;
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
63
static
AxisAngleBase
identity
()
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
82
BLI_STRUCT_EQUALITY_OPERATORS_2
(
AxisAngleBase
, axis_, angle_)
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
90
using
AxisAngle
=
AxisAngleBase<float, AngleRadianBase<float>
>;
91
using
AxisAngleCartesian
=
AxisAngleBase<float, AngleCartesianBase<float>
>;
92
93
}
// namespace blender::math
BLI_math_angle_types.hh
BLI_math_base.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:29
blender::math::AxisSigned
Definition
BLI_math_basis_types.hh:101
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:32
blender::math::AxisAngleBase::AxisAngleBase
AxisAngleBase()=default
blender::math::AxisAngleBase::identity
static AxisAngleBase identity()
Definition
BLI_math_axis_angle_types.hh:63
blender::math::AxisAngleBase::angle
const AngleT & angle() const
Definition
BLI_math_axis_angle_types.hh:75
blender::math::AxisAngleBase::axis
const vec3_type & axis() const
Definition
BLI_math_axis_angle_types.hh:70
Generated on Thu Feb 6 2025 07:36:39 for Blender by
doxygen
1.11.0