24 #define _USE_MATH_DEFINES // for M_PI 34 #include "config_auto.h" 60 point_heap->
Push(&pair);
63 #ifndef GRAPHICS_DISABLED 88 vector1.
x = point2->
pos.
x - point1->
pos.
x;
89 vector1.
y = point2->
pos.
y - point1->
pos.
y;
90 vector2.
x = point3->
pos.
x - point2->
pos.
x;
91 vector2.
y = point3->
pos.
y - point2->
pos.
y;
93 float length = std::sqrt(static_cast<float>(
LENGTH(vector1)) *
LENGTH(vector2));
94 if (static_cast<int>(length) == 0)
96 angle =
static_cast<int>(floor(asin(
CROSS (vector1, vector2) /
97 length) / M_PI * 180.0 + 0.5));
100 if (
SCALAR (vector1, vector2) < 0)
119 EDGEPT *best_point =
nullptr;
124 found_better =
false;
126 this_distance =
edgept_dist (critical_point, vertical_point);
127 if (this_distance <= *best_dist) {
133 *best_dist = this_distance;
134 best_point = vertical_point;
139 vertical_point = vertical_point->
next;
141 while (found_better ==
true);
156 EDGEPT *local_min =
nullptr;
157 EDGEPT *local_max =
nullptr;
159 this_point = outline->
loop;
160 local_min = this_point;
161 local_max = this_point;
163 if (this_point->
vec.
y < 0) {
165 if (local_max !=
nullptr)
170 local_min = this_point->
next;
172 else if (this_point->
vec.
y > 0) {
174 if (local_min !=
nullptr)
179 local_max = this_point->
next;
183 if (local_max !=
nullptr) {
187 local_max = this_point->
next;
194 local_min = this_point->
next;
200 this_point = this_point->
next;
202 while (this_point != outline->
loop);
268 EDGEPT_CLIST *new_points) {
271 EDGEPT_C_IT new_point_it(new_points);
272 int x = split_point->
pos.
x;
275 if (*best_point !=
nullptr)
281 if (((p->
pos.
x <= x && x <= p->next->pos.x) ||
282 (p->
next->
pos.
x <= x && x <= p->pos.x)) &&
286 (*best_point ==
nullptr || !
same_point((*best_point)->pos, p->
pos))) {
289 new_point_it.add_before_then_move(this_edgept);
292 if (*best_point ==
nullptr)
293 best_dist =
edgept_dist (split_point, this_edgept);
298 *best_point = this_edgept;
303 while (p != target_point);
PRIORITY point_priority(EDGEPT *point)
int angle_change(EDGEPT *point1, EDGEPT *point2, EDGEPT *point3)
void vertical_projection_point(EDGEPT *split_point, EDGEPT *target_point, EDGEPT **best_point, EDGEPT_CLIST *new_points)
void prioritize_points(TESSLINE *outline, PointHeap *points)
void add_point_to_list(PointHeap *point_heap, EDGEPT *point)
#define same_point(p1, p2)
#define is_exterior_point(edge, point)
bool near_point(EDGEPT *point, EDGEPT *line_pt_0, EDGEPT *line_pt_1, EDGEPT **near_pt)
EDGEPT * pick_close_point(EDGEPT *critical_point, EDGEPT *vertical_point, int *best_dist)
int direction(EDGEPT *point)
void new_min_point(EDGEPT *local_min, PointHeap *points)
bool is_inside_angle(EDGEPT *pt)
void new_max_point(EDGEPT *local_max, PointHeap *points)
#define edgept_dist(p1, p2)
void mark_outline(EDGEPT *edgept)