acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
arc.h
1#pragma once
2
3
4#include "angle.h"
5#include "point.h"
6#include "size.h"
7#include "ellipse.h"
8//#include "contains.h"
9
10
11template < prototype_number NUMBER >
12class arc_type :
13 public ellipse_type < NUMBER >
14{
15public:
16
17 using UNIT_TYPE = NUMBER;
18
19 //::point_type < UNIT_TYPE > m_pointCenter;
20 //::size_type < UNIT_TYPE> m_sizeRadius;
21 ::point_type < UNIT_TYPE > m_pointBegin;
22 ::point_type < UNIT_TYPE > m_pointEnd;
23 ::f64_angle m_angleBeg;
24 ::f64_angle m_angleExt;
25 ::f64_angle m_angleEnd2;
26 ::f64_angle m_angleRotation;
27
28
29 void offset(const ::size_type < UNIT_TYPE > & offset)
30 {
31
32 ellipse_type < NUMBER >::offset(offset);
33 //m_pointCenter += offset;
34 m_pointBegin += offset;
35 m_pointEnd += offset;
36
37 }
38
39 bool contains(const ::point_type < UNIT_TYPE > & point)
40 {
41
42 if(!::rectangle_type < NUMBER >::contains(point))
43 {
44
45 return false;
46
47 }
48
49 auto center = this->center();
50
51 auto radius = this->radius();
52
53 if (!::ellipse_type < NUMBER >::contains(center, radius, point))
54 {
55
56 return false;
57
58 }
59
60 //auto angle = ::ellipse_angle(m_pointCenter, m_sizeRadius, point);
61
62 auto angle = ::angle(center, point);
63
64 if (angle < m_angleBeg || angle > m_angleEnd2)
65 {
66
67 return false;
68
69 }
70
71 return true;
72
73 }
74
75
76};
77
78
79
Definition arc.h:14