20# include "config_auto.h"
35#define INTERSECTING INT16_MAX
37int lessthan(
const void *first,
const void *second);
40 ICOORDELT_IT v = &vertices;
52 ICOORDELT_IT v = &vertices;
73 ICOORDELT_IT pts = &vertices;
75 botleft = *pts.data();
79 if (pos.
x() < botleft.
x()) {
81 botleft =
ICOORD(pos.
x(), botleft.
y());
83 if (pos.
y() < botleft.
y()) {
84 botleft =
ICOORD(botleft.
x(), pos.
y());
86 if (pos.
x() > topright.
x()) {
87 topright =
ICOORD(pos.
x(), topright.
y());
89 if (pos.
y() > topright.
y()) {
90 topright =
ICOORD(topright.
x(), pos.
y());
93 }
while (!pts.at_first());
94 ibl =
ICOORD(botleft.
x(), botleft.
y());
95 itr =
ICOORD(topright.
x(), topright.
y());
112 ICOORDELT_IT it = &vertices;
118 vvec = *it.data_relative(1) - pt;
120 if (vec.
y() <= 0 && vec.
y() + vvec.
y() > 0) {
124 }
else if (cross == 0) {
127 }
else if (vec.
y() > 0 && vec.
y() + vvec.
y() <= 0) {
131 }
else if (cross == 0) {
134 }
else if (vec.
y() == 0 && vec.
x() == 0) {
138 }
while (!it.at_first());
145 ICOORDELT_IT it = &vertices;
164 }
while (!it.at_first());
169 it.set_to_list(other->
points());
180 }
while (!it.at_first());
194 ICOORDELT_IT pts = &vertices;
204 }
while (!pts.at_first());
216 ICOORDELT_IT pts = &vertices;
222 }
while (!pts.at_first());
235 ICOORDELT_IT pts = &vertices;
241 }
while (!pts.at_first());
245#ifndef GRAPHICS_DISABLED
247 ICOORDELT_IT v = &vertices;
256# if !defined(_WIN32) || defined(__MINGW32__)
257 snprintf(temp_buff,
sizeof(temp_buff),
"%" PRId32, num);
259 _ltoa(num, temp_buff, 10);
261 window->
Text(v.data()->x(), v.data()->y(), temp_buff);
264 window->
SetCursor(v.data()->x(), v.data()->y());
265 for (v.mark_cycle_pt(); !v.cycled_list(); v.forward()) {
266 window->
DrawTo(v.data()->x(), v.data()->y());
269 window->
DrawTo(v.data()->x(), v.data()->y());
275 std::unique_ptr<PB_LINE_IT> lines(
new PB_LINE_IT(
this));
279 const std::unique_ptr< ICOORDELT_LIST> segments(lines->get_line(
y));
280 if (!segments->empty()) {
281 s_it.set_to_list(segments.get());
282 for (s_it.mark_cycle_pt(); !s_it.cycled_list(); s_it.forward()) {
286 auto width = s_it.data()->y();
288 window->
DrawTo(s_it.data()->x() +
static_cast<float>(width),
y);
298 ICOORDELT_IT it = &vertices;
317 }
while (!it.at_first());
322 it.set_to_list(other->
points());
333 }
while (!it.at_first());
339 ICOORDELT_LIST *result;
342 result =
new ICOORDELT_LIST();
343 r.set_to_list(result);
344 v.set_to_list(block->
points());
346 for (v.mark_cycle_pt(); !v.cycled_list(); v.forward()) {
347 if (((v.data_relative(-1)->y() >
y) && (v.data()->y() <=
y)) ||
348 ((v.data_relative(-1)->y() <=
y) && (v.data()->y() >
y))) {
349 previous = v.data_relative(-1);
352 0.5f + previous->
x() +
353 (current->
x() - previous->
x()) * (fy - previous->
y()) / (current->
y() - previous->
y());
361 for (r.mark_cycle_pt(); !r.cycled_list(); r.forward()) {
364 for (r.mark_cycle_pt(); !r.cycled_list(); r.forward()) {
365 r.data()->set_y(r.data_relative(1)->x() - r.data()->x());
367 delete (r.extract());
374int lessthan(
const void *first,
const void *second) {
378 if (p1->
x() < p2->
x()) {
380 }
else if (p1->
x() > p2->
x()) {
387#ifndef GRAPHICS_DISABLED
411 return kPBColors[type];
int lessthan(const void *first, const void *second)
void set_x(TDimension xin)
rewrite function
TDimension y() const
access_function
void set_y(TDimension yin)
rewrite function
TDimension x() const
access function
void set_y(float yin)
rewrite function
void set_x(float xin)
rewrite function
void rotate(const FCOORD vec)
ICOORDELT_LIST * points()
bool overlap(POLY_BLOCK *other)
void rotate(FCOORD rotation)
static ScrollView::Color ColorForPolyBlockType(PolyBlockType type)
Returns a color to draw the given type.
void fill(ScrollView *window, ScrollView::Color colour)
void plot(ScrollView *window, int32_t num)
bool contains(POLY_BLOCK *other)
int16_t winding_number(const ICOORD &test_pt)
ICOORDELT_LIST * get_line(TDimension y)
bool overlap(const TBOX &box) const
TDimension bottom() const
void TextAttributes(const char *font, int pixel_size, bool bold, bool italic, bool underlined)
void Text(int x, int y, const char *mystring)
void SetCursor(int x, int y)
void DrawTo(int x, int y)