acme
Foundational cross-platform layer of the ca2 framework
Toggle main menu visibility
Loading...
Searching...
No Matches
contains.h
1
#pragma once
2
3
4
//template < prototype_number NUMBER, prototype_point POINT >
5
//inline bool shape_contains(const ::arc_type < NUMBER > & arc, const POINT & point)
6
//{
7
//
8
// // BUG SS (STILL SIMPLE) using bounding box HAHA LOL ROFL
9
//
10
// ::i32_rectangle rectangle;
11
//
12
// if (!get_bounding_box(rectangle, arc))
13
// {
14
//
15
// return false;
16
//
17
// }
18
//
19
// return rectangle.contains(point);
20
//
21
//}
22
23
//
24
//template < prototype_number NUMBER, prototype_point POINT >
25
//inline bool shape_contains(const line_base < NUMBER > & line, const POINT & point)
26
//{
27
//
28
// return false;
29
//
30
//}
31
32
//
33
//template < prototype_rectangle RECTANGLE, prototype_point POINT >
34
//inline bool shape_contains(const RECTANGLE & rectangle, const POINT & point)
35
//{
36
//
37
// return ::contains(rectangle, point.x, point.y);
38
//
39
//}
40
//
41
42
// https://forums.codeguru.com/showthread.php?419763-Check-a-::i32_point-lies-in-a-Line-segment
43
44
45
template
< prototype_number NUMBER1, prototype_number NUMBER2, prototype_number NUMBER >
46
bool
segment_contains(const ::point_type < NUMBER1 > & point1, const ::point_type < NUMBER2 > & point2, const ::point_type < NUMBER > & point, const ::f32 epsilon = 0.001f)
47
{
48
49
auto
dx = point2.x - point1.x;
50
51
auto
dy = point2.y - point1.y;
52
53
return ::is_equal(((point.x - point1.x) * dy), ((point.y - point1.y) * dx), epsilon);
54
55
//return false;
56
}
57
58
59
//
60
//template < prototype_number NUMBER1, prototype_number NUMBER2, prototype_number NUMBER >
61
//bool ellipse_contains(const ::point_type < NUMBER1 > & center, const ::size_type < NUMBER2 > & radius, const ::point_type < NUMBER > & point)
62
//{
63
//
64
//}
65
//
66
//
67
68
prototype
geometry2d
contains.h
Generated by
1.17.0