Horizon
tool_round_off_vertex.hpp
1 #pragma once
2 #include "common/polygon.hpp"
3 #include "tool_helper_plane.hpp"
4 
5 namespace horizon {
6 
7 class ToolRoundOffVertex : public virtual ToolBase, public ToolHelperPlane {
8 public:
9  using ToolBase::ToolBase;
10  ToolResponse begin(const ToolArgs &args) override;
11  ToolResponse update(const ToolArgs &args) override;
12  bool can_begin() override;
13  bool is_specific() override
14  {
15  return true;
16  }
17  std::set<InToolActionID> get_actions() const override
18  {
19  using I = InToolActionID;
20  return {
21  I::LMB, I::CANCEL, I::RMB, I::ENTER_DATUM, I::FLIP_ARC,
22  };
23  }
24 
25 private:
26  Polygon *poly = nullptr;
27  int wrap_index(int i) const;
28 
29  Polygon::Vertex *vxn = nullptr;
30  Polygon::Vertex *vxp = nullptr;
31 
32  Coord<double> p0;
33  Coord<double> vp;
34  Coord<double> vn;
35  Coord<double> vh;
36  double delta_max = 0;
37  double r_max = 0;
38  double alpha = 0;
39  double radius_current = 0;
40 
41  void update_poly(double r);
42  void update_cursor(const Coordi &c);
43  void update_tip();
44 
45  bool orientation = false;
46 };
47 } // namespace horizon
This is what a Tool receives when the user did something.
Definition: tool.hpp:23
Common interface for all Tools.
Definition: tool.hpp:121
Definition: tool_helper_plane.hpp:5
To signal back to the core what the Tool did, a Tool returns a ToolResponse.
Definition: tool.hpp:42
Definition: tool_round_off_vertex.hpp:7
ToolResponse begin(const ToolArgs &args) override
Gets called right after the constructor has finished.
Definition: tool_round_off_vertex.cpp:37
bool is_specific() override
Definition: tool_round_off_vertex.hpp:13
ToolResponse update(const ToolArgs &args) override
Gets called whenever the user generated some sort of input.
Definition: tool_round_off_vertex.cpp:134
bool can_begin() override
Definition: tool_round_off_vertex.cpp:12