23#define _USE_MATH_DEFINES
32# include "config_auto.h"
38static int direction(
const EDGEPT *point) {
42 const EDGEPT *prev = point->prev;
44 const EDGEPT *
next = point->next;
46 if (((prev->pos.x <= point->pos.x) && (point->pos.x <
next->pos.x)) ||
47 ((prev->pos.x < point->pos.x) && (point->pos.x <=
next->pos.x))) {
50 if (((prev->pos.x >= point->pos.x) && (point->pos.x >
next->pos.x)) ||
51 ((prev->pos.x > point->pos.x) && (point->pos.x >=
next->pos.x))) {
76 point_heap->
Push(&pair);
79#ifndef GRAPHICS_DISABLED
105 vector1.
x = point2->
pos.
x - point1->
pos.
x;
106 vector1.
y = point2->
pos.
y - point1->
pos.
y;
107 vector2.
x = point3->
pos.
x - point2->
pos.
x;
108 vector2.
y = point3->
pos.
y - point2->
pos.
y;
110 float length = std::sqrt(
static_cast<float>(vector1.
length()) * vector2.
length());
111 if (
static_cast<int>(length) == 0) {
114 angle =
static_cast<int>(floor(std::asin(vector1.
cross(vector2) / length) / M_PI * 180.0 + 0.5));
117 if (vector1.
dot(vector2) < 0) {
137 EDGEPT *best_point =
nullptr;
142 found_better =
false;
144 this_distance =
edgept_dist(critical_point, vertical_point);
145 if (this_distance <= *best_dist) {
150 *best_dist = this_distance;
151 best_point = vertical_point;
152 if (chop_vertical_creep) {
157 vertical_point = vertical_point->
next;
158 }
while (found_better ==
true);
172 EDGEPT *local_min =
nullptr;
173 EDGEPT *local_max =
nullptr;
175 this_point = outline->
loop;
176 local_min = this_point;
177 local_max = this_point;
179 if (this_point->
vec.
y < 0) {
181 if (local_max !=
nullptr) {
187 local_min = this_point->
next;
188 }
else if (this_point->
vec.
y > 0) {
190 if (local_min !=
nullptr) {
196 local_max = this_point->
next;
199 if (local_max !=
nullptr) {
203 local_max = this_point->
next;
209 local_min = this_point->
next;
215 this_point = this_point->
next;
216 }
while (this_point != outline->
loop);
229 dir = direction(local_min);
252 dir = direction(local_max);
278 EDGEPT **best_point, EDGEPT_CLIST *new_points) {
281 EDGEPT_C_IT new_point_it(new_points);
282 int x = split_point->
pos.
x;
285 if (*best_point !=
nullptr) {
292 if (((
p->pos.x <=
x && x <= p->
next->pos.x) || (
p->next->pos.x <=
x && x <= p->pos.x)) &&
294 !
p->IsChopPt() && (*best_point ==
nullptr || !
same_point((*best_point)->pos,
p->pos))) {
295 if (
near_point(split_point,
p,
p->next, &this_edgept)) {
296 new_point_it.add_before_then_move(this_edgept);
299 if (*best_point ==
nullptr) {
305 *best_point = this_edgept;
310 }
while (
p != target_point);
#define edgept_dist(p1, p2)
#define is_exterior_point(edge, point)
#define same_point(p1, p2)
void mark_outline(EDGEPT *edgept)
int dot(const TPOINT &other) const
int cross(const TPOINT &other) const
bool is_inside_angle(EDGEPT *pt)
void new_min_point(EDGEPT *local_min, PointHeap *points)
void add_point_to_list(PointHeap *point_heap, EDGEPT *point)
void prioritize_points(TESSLINE *outline, PointHeap *points)
int angle_change(EDGEPT *point1, EDGEPT *point2, EDGEPT *point3)
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)
void vertical_projection_point(EDGEPT *split_point, EDGEPT *target_point, EDGEPT **best_point, EDGEPT_CLIST *new_points)
PRIORITY point_priority(EDGEPT *point)
void new_max_point(EDGEPT *local_max, PointHeap *points)