Antkeeper  0.0.1
ik-goal.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_IK_GOAL_HPP
21 #define ANTKEEPER_ANIMATION_IK_GOAL_HPP
22 
24 #include <engine/math/vector.hpp>
25 #include <memory>
26 
30 class ik_goal
31 {
32 public:
38  inline void set_solver(std::shared_ptr<ik_solver> solver) noexcept
39  {
40  m_solver = solver;
41  }
42 
48  inline void set_center(const math::fvec3& center) noexcept
49  {
50  m_center = center;
51  }
52 
58  inline void set_radius(float radius) noexcept
59  {
60  m_radius = radius;
61  m_sqr_radius = m_sqr_radius * m_sqr_radius;
62  }
63 
65  [[nodiscard]] inline const std::shared_ptr<ik_solver>& get_solver() const noexcept
66  {
67  return m_solver;
68  }
69 
71  [[nodiscard]] inline const math::fvec3& get_center() const noexcept
72  {
73  return m_center;
74  }
75 
77  [[nodiscard]] inline float get_radius() const noexcept
78  {
79  return m_radius;
80  }
81 
82 private:
83  std::shared_ptr<ik_solver> m_solver;
84  math::fvec3 m_center{};
85  float m_radius{1e-3f};
86  float m_sqr_radius{1e-6f};
87 };
88 
89 #endif // ANTKEEPER_ANIMATION_IK_GOAL_HPP
IK goal.
Definition: ik-goal.hpp:31
void set_center(const math::fvec3 &center) noexcept
Sets the center of the IK goal.
Definition: ik-goal.hpp:48
void set_solver(std::shared_ptr< ik_solver > solver) noexcept
Sets the solver of the IK goal.
Definition: ik-goal.hpp:38
void set_radius(float radius) noexcept
Sets the radius of the IK goal.
Definition: ik-goal.hpp:58
const math::fvec3 & get_center() const noexcept
Returns the center of the IK goal.
Definition: ik-goal.hpp:71
const std::shared_ptr< ik_solver > & get_solver() const noexcept
Returns the solver of the IK goal.
Definition: ik-goal.hpp:65
float get_radius() const noexcept
Returns the radius of the IK goal.
Definition: ik-goal.hpp:77
n-dimensional vector.
Definition: vector.hpp:44