HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
src
hikogui
geometry
rotate2.hpp
1
// Copyright Take Vos 2021-2022.
2
// Distributed under the Boost Software License, Version 1.0.
3
// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5
#pragma once
6
7
#include "../macros.hpp"
8
namespace
hi
{
inline
namespace
v1
{
9
10
class
rotate2
{
11
public
:
12
using
array_type =
simd<float, 4>
;
13
using
value_type = array_type::value_type;
14
15
constexpr
rotate2
(
rotate2
const
&)
noexcept
=
default
;
16
constexpr
rotate2
(
rotate2
&&)
noexcept
=
default
;
17
constexpr
rotate2
& operator=(
rotate2
const
&)
noexcept
=
default
;
18
constexpr
rotate2
& operator=(
rotate2
&&)
noexcept
=
default
;
19
constexpr
rotate2
()
noexcept
: _v(0.0f, 0.0f, 1.0f, 0.0f) {}
20
21
[[
nodiscard
]]
rotate2
(
float
angle
)
noexcept
: _v()
22
{
23
hilet
half_angle
=
angle
* 0.5f;
24
hilet C =
std::cos
(
half_angle
);
25
hilet S =
std::sin
(
half_angle
);
26
27
_v =
f32x4
{0.0f, 0.0f, 1.0f, 0.0f} * S;
28
_v.w() = C;
29
}
30
31
[[
nodiscard
]]
constexpr
explicit
operator
array_type()
const
noexcept
32
{
33
return
_v;
34
}
35
36
//std::pair<float, vector3> angle_and_axis() const noexcept
37
//{
38
// hilet rcp_length = rcp_hypot<0b0111>(_v);
39
// hilet length = 1.0f / rcp_length;
40
//
41
// return {2.0f * std::atan2(length), vector3{_v.xyz0() * rcp_length}};
42
//}
43
44
private
:
48
array_type _v;
49
};
50
51
}}
// namespace hi::v1
v1
DOXYGEN BUG.
Definition
algorithm.hpp:16
hi
geometry/margins.hpp
Definition
lookahead_iterator.hpp:5
hi::v1::narrow_cast
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition
cast.hpp:377
hi::rotate2
Definition
rotate2.hpp:10
std::cos
T cos(T... args)
std::sin
T sin(T... args)
Generated on Mon Apr 22 2024 12:53:16 for HikoGUI by
1.10.0