void main(void) { int gdriver=DETECT, gmode, MaxX, MaxY; DevPt pa, pc; initgraph (&gdriver, &gmode, ""); MaxX = getmaxx(); MaxY = getmaxy(); pc.x = (MaxX + 1) >> 1; pc.y = (MaxY + 1) >> 1; for (pa.x=0, pa.y=0; pa.x < MaxX ; pa.x += 4) b_line (&pc, &pa, RED); for (pa.x=MaxX, pa.y=0; pa.y < MaxY ; pa.y += 3) b_line (&pc, &pa, GREEN); for (pa.x=MaxX, pa.y=MaxY; pa.x >= 0 ; pa.x -= 4) b_line (&pc, &pa, LIGHTRED); for (pa.x=0, pa.y=MaxY; pa.y >= 0 ; pa.y -= 3) b_line (&pc, &pa, LIGHTGREEN); getchar(); }
int main() { initwindow(640, 360, "DDA - railway"); b_line(12,12,300,300); while ( !kbhit() ) delay(100); return EXIT_SUCCESS; }
void turningDrowLine(cv::Mat * image) { if ( image == NULL ) return; float len = std::min(image->cols, image->rows); Geometry::Line_2d b_line(Geometry::Point2f(len/2+100, len/2+len/4), Geometry::Point2f(len/2-100, len/2+len/4)); Geometry::Point2f turn_center(len/2,len/2); int n = 11; for (int i =0; i < n; ++i) { Geometry::Line_2d dr_line(b_line); Geometry::turnShape(&dr_line, 2*M_PI*i/n, turn_center); Geometry::drowShape(dr_line, image, cv::Scalar(0), 1, cv::Scalar(0), 0); } }