📄 rect.c.svn-base
字号:
#include "matrix.h"#include "rect.h"long getrectWidth(Rect rect) { return rect.Xmax-rect.Xmin;};long getrectHeight(Rect rect) { return rect.Ymax-rect.Ymin;};/*void print() { printf("Xmin = %d Xmax = %d Ymin = %d Ymax = %d\n", (int)xmin,(int)xmax,(int)ymin,(int)ymax); };*/void resetrect(Rect *rect) { rect->Xmin = LONG_MAX; rect->Ymin = LONG_MAX; rect->Xmax = LONG_MIN; rect->Ymax = LONG_MIN;}void bbox(Rect *rect, Matrix *m, long x1, long y1) { long x,y; x = getX(m,x1,y1); y = getY(m,x1,y1); //printf("x is %ld,y is %ld\n",x1,y1); //printf("rect.xmin=%ld, rect.xmax=%ld,rect.ymin=%ld,rect.ymax=%ld\n",rect->Xmin,rect->Ymin,rect->Xmax,rect->Ymax); if (x < rect->Xmin) rect->Xmin = x; if (x > rect->Xmax) rect->Xmax = x; if (y < rect->Ymin) rect->Ymin = y; if (y > rect->Ymax) rect->Ymax = y;}// Update bb to include boundary, optional reset of bbvoid transformBoundingBox(Rect *bb, Matrix *matrix, Rect *boundary, int reset) { if (reset) { resetrect(bb); } // //printf("xmin=%ld, xmax=%ld,ymin=%ld,ymax=%ld\n",bb->Xmin,bb->Xmax,bb->Ymin,bb->Ymax); if (boundary->Xmin != LONG_MAX) { bbox(bb, matrix, boundary->Xmin, boundary->Ymin); bbox(bb, matrix, boundary->Xmax, boundary->Ymin); bbox(bb, matrix, boundary->Xmin, boundary->Ymax); bbox(bb, matrix, boundary->Xmax, boundary->Ymax); }}unsigned char SQRT[] = { 0,1,1,1,2,2,2,2,2,3,3,3,3,3,3,3, 4,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5, 5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6, 6,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, 9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10, 10,10,10,10,10,10,10,10,10,11,11,11,11,11,11,11, 11,11,11,11,11,11,11,11,11,11,11,11,11,11,11,11, 12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12, 12,12,12,12,12,12,12,12,12,13,13,13,13,13,13,13, 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13, 13,13,13,13,14,14,14,14,14,14,14,14,14,14,14,14, 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14, 14,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, 15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16, 16,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17, 17,17,17,17,18,18,18,18,18,18,18,18,18,18,18,18, 18,18,18,18,18,18,18,18,18,18,18,18,18,18,18,18, 18,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19, 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, 19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19, 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20, 20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20, 20,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21, 21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21, 21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21, 21,21,21,21,22,22,22,22,22,22,22,22,22,22,22,22, 22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22, 22,22,22,22,22,22,22,22,22,22,22,22,22,22,22,22, 22,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23, 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23, 23,23,23,23,23,23,23,23,23,23,23,23,23,23,23,23, 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, 24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24, 24,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25, 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25, 25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25, 25,25,25,25,26,26,26,26,26,26,26,26,26,26,26,26, 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26, 26,26,26,26,26,26,26,26,26,26,26,26,26,26,26,26, 26,26,26,26,26,26,26,26,26,27,27,27,27,27,27,27, 27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27, 27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27, 27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27, 28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28, 28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28, 28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28, 28,28,28,28,28,28,28,28,28,29,29,29,29,29,29,29, 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29, 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29, 29,29,29,29,29,29,29,29,29,29,29,29,29,29,29,29, 29,29,29,29,30,30,30,30,30,30,30,30,30,30,30,30, 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30, 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30, 30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30, 30,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, 31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31, 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, 32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32, 32,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33, 33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33, 33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33, 33,33,33,33,33,33,33,33,33,33,33,33,33,33,33,33, 33,33,33,33,34,34,34,34,34,34,34,34,34,34,34,34, 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, 34,34,34,34,34,34,34,34,34,34,34,34,34,34,34,34, 34,34,34,34,34,34,34,34,34,35,35,35,35,35,35,35, 35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35, 35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35, 35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35, 35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35, 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36, 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36, 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36, 36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36, 36,36,36,36,36,36,36,36,36,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37, 37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37, 37,37,37,37,38,38,38,38,38,38,38,38,38,38,38,38, 38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38, 38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38, 38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38, 38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38, 38,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39, 39,39,39,39,39,39,39,39,39,39,39,39,39,39,39,39, 40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40, 40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40, 40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40, 40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40, 40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40, 40,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,41,41,41,41,41,41,41,41,41,41,41,41, 41,41,41,41,42,42,42,42,42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42, 42,42,42,42,42,42,42,42,42,43,43,43,43,43,43,43, 43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43, 43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -