acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
line.h
1#pragma once
2
3
4template < prototype_number NUMBER >
5class line_type
6{
7public:
8
9 using LINE_TYPE = line_type < NUMBER >;
10 using UNIT_TYPE = NUMBER;
11 //using SIZE_TYPE = typename POINT_TYPE::SIZE_TYPE;
12 //using RECTANGLE_TYPE = typename POINT_TYPE::RECTANGLE_TYPE;
13
14
15 ::point_type < UNIT_TYPE > m_p1;
16 ::point_type < UNIT_TYPE > m_p2;
17
18
19 line_type() {}
20 line_type(const line_type& line):m_p1(line.m_p1), m_p2(line.m_p2) {}
21
22
23 bool contains(const ::point_type <NUMBER > & point, ::f32 epsilon = 0.001f)
24 {
25
26 return segment_contains(m_p1, m_p2, point, epsilon);
27
28 }
29
30
31 line_type & offset(const ::point_type < NUMBER > & point)
32 {
33
34 m_p1.offset(point);
35
36 m_p2.offset(point);
37
38 return *this;
39
40 }
41
42
43 void expand_bounding_box(::point_type < UNIT_TYPE > & top_left, ::point_type < UNIT_TYPE > & bottom_right)
44 {
45
46 m_p1.expand_bounding_box(top_left, bottom_right);
47
48 m_p2.expand_bounding_box(top_left, bottom_right);
49
50 }
51
52
53};
54
55
56