Antkeeper  0.0.1
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
euler-ik-constraint.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2023 Christopher J. Howard
3  *
4  * This file is part of Antkeeper source code.
5  *
6  * Antkeeper source code is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Antkeeper source code is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with Antkeeper source code. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef ANTKEEPER_ANIMATION_EULER_IK_CONSTRAINT_HPP
21 #define ANTKEEPER_ANIMATION_EULER_IK_CONSTRAINT_HPP
22 
25 #include <engine/math/numbers.hpp>
26 
31 {
32 public:
33  void solve(math::fquat& q) override;
34 
40  inline void set_rotation_sequence(math::rotation_sequence sequence) noexcept
41  {
42  m_rotation_sequence = sequence;
43  }
44 
50  inline void set_min_angles(const math::fvec3& angles) noexcept
51  {
52  m_min_angles = angles;
53  }
54 
60  inline void set_max_angles(const math::fvec3& angles) noexcept
61  {
62  m_max_angles = angles;
63  }
64 
66  [[nodiscard]] inline constexpr math::rotation_sequence get_rotation_sequence() const noexcept
67  {
68  return m_rotation_sequence;
69  }
70 
72  [[nodiscard]] inline constexpr const math::fvec3& get_min_angles() const noexcept
73  {
74  return m_min_angles;
75  }
76 
78  [[nodiscard]] inline constexpr const math::fvec3& get_max_angles() const noexcept
79  {
80  return m_max_angles;
81  }
82 
83 private:
85  math::fvec3 m_min_angles{-math::pi<float>, -math::pi<float>, -math::pi<float>};
86  math::fvec3 m_max_angles{ math::pi<float>, math::pi<float>, math::pi<float>};
87 };
88 
89 #endif // ANTKEEPER_ANIMATION_EULER_IK_CONSTRAINT_HPP
Euler angle IK constraint.
void set_max_angles(const math::fvec3 &angles) noexcept
Sets the maximum Euler angles of the constraint.
constexpr const math::fvec3 & get_min_angles() const noexcept
Returns the minimum angles of the first, second, and third Euler angles, in radians.
void set_min_angles(const math::fvec3 &angles) noexcept
Sets the minimum Euler angles of the constraint.
void solve(math::fquat &q) override
Solves the constraint.
void set_rotation_sequence(math::rotation_sequence sequence) noexcept
Sets the rotation sequence of the Euler angles of the constraint.
constexpr math::rotation_sequence get_rotation_sequence() const noexcept
Returns the rotation sequence of the Euler angles of the constraint.
constexpr const math::fvec3 & get_max_angles() const noexcept
Returns the maximum angles of the first, second, and third Euler angles, in radians.
Abstract base class for IK joint constraints.
rotation_sequence
Rotation sequences of proper Euler and Tait-Bryan angles.
@ xyz
x-y-z rotation sequence (Tait-Bryan angles).
Quaternion composed of a real scalar part and imaginary vector part.
Definition: quaternion.hpp:39
n-dimensional vector.
Definition: vector.hpp:44