/********************************************************************** * mark_outline * * Make a mark on the edges window at a particular location. **********************************************************************/ void mark_outline(EDGEPT *edgept) { /* Start of point list */ void *window = edge_window; float x = edgept->pos.x; float y = edgept->pos.y; c_line_color_index(window, Red); c_move(window, x, y); x -= 4; y -= 12; c_draw(window, x, y); x -= 2; y += 4; c_draw(window, x, y); x -= 4; y += 2; c_draw(window, x, y); x += 10; y += 6; c_draw(window, x, y); c_make_current(window); }
/*---------------------------------------------------------------------------- Public Code -----------------------------------------------------------------------------*/ void DisplayProtoList(const char* ch, LIST protolist) { void* window = c_create_window("Char samples", 50, 200, 520, 520, -130.0, 130.0, -130.0, 130.0); LIST proto = protolist; iterate(proto) { PROTOTYPE* prototype = reinterpret_cast<PROTOTYPE *>(first_node(proto)); if (prototype->Significant) c_line_color_index(window, Green); else if (prototype->NumSamples == 0) c_line_color_index(window, Blue); else if (prototype->Merged) c_line_color_index(window, Magenta); else c_line_color_index(window, Red); float x = CenterX(prototype->Mean); float y = CenterY(prototype->Mean); double angle = OrientationOf(prototype->Mean) * 2 * M_PI; float dx = static_cast<float>(LengthOf(prototype->Mean) * cos(angle) / 2); float dy = static_cast<float>(LengthOf(prototype->Mean) * sin(angle) / 2); c_move(window, (x - dx) * 256, (y - dy) * 256); c_draw(window, (x + dx) * 256, (y + dy) * 256); if (prototype->Significant) tprintf("Green proto at (%g,%g)+(%g,%g) %d samples\n", x, y, dx, dy, prototype->NumSamples); else if (prototype->NumSamples > 0 && !prototype->Merged) tprintf("Red proto at (%g,%g)+(%g,%g) %d samples\n", x, y, dx, dy, prototype->NumSamples); } c_make_current(window); }
/********************************************************************** * mark_split * * Set up the marks list to be displayed in subsequent updates and draw * the marks in the current window. The marks are stored in the second * sublist. The first sublist is left unmodified. **********************************************************************/ void mark_split(SPLIT *split) { void *window = edge_window; c_line_color_index(window, Green); c_move (window, (float) split->point1->pos.x, (float) split->point1->pos.y); c_draw (window, (float) split->point2->pos.x, (float) split->point2->pos.y); c_make_current(window); }
/********************************************************************** * render_edgepts * * Create a list of line segments that represent the expanded outline * that was supplied as input. **********************************************************************/ void render_edgepts(void *window, EDGEPT *edgept, C_COL color) { float x = edgept->pos.x; float y = edgept->pos.y; EDGEPT *this_edge = edgept; if (!edgept) return; c_line_color_index(window, color); c_move(window, x, y); do { this_edge = this_edge->next; x = this_edge->pos.x; y = this_edge->pos.y; c_draw(window, x, y); } while (edgept != this_edge); }