//draw 鼠标画线 //鼠标画线//在屏幕上使用鼠标画线 namespace mouse.draw import mouse import math; //返回屏幕宽度,高度 function getScreenWidthHeight(){ return ::User32.GetSystemMetrics(0x0/*_SM_CXSCREEN*/), ::User32.GetSystemMetrics(0x1/*_SM_CYSCREEN*/ ) } /* 画线回调函数 参数: x,y : 当前坐标 返回值: 为true表示继续,返回false表示停止画线 */ move = function(x,y){ error("使用mouse.draw函数库以前,必须重写mouse.draw.move函数",2); return false; } /* 画直线 参数: x1,y1 起始坐标 x2,y2 结束坐标 */ line = function(x1,y1,x2,y2) { var step = 1; var x,y; var xx = x2-x1; var yy = y2-y1; var k; if(math.abs(xx) > math.abs(yy) ) { if(x21 ) { x = x1+4*( math.cos(n)+n*math.sin(n) ); y = y1+3*( math.sin(n)-n*math.cos(n) ); if(! move(x,y) ) return false;; n = n-.2 } return true; } /* 画渐开线2 参数: x,y 基圆圆心 R 基圆半径 n 渐开线周波数 */ involute2 = function(x,y,R,n) { for a=0;2 * 360 * n;2 { x = x + R * (math.cos(a * math.pi / 360) + (a * math.pi / 360) * math.sin(a * math.pi / 360)); y = y + R * (math.sin(a * math.pi / 360) - (a * math.pi / 360) * math.cos(a * math.pi / 360)); if(! move(x,y) ) return false;; } return true; } /* 画方形仿渐开线 参数: step 步长 n 起始正方形边长,指定中间忽略不扫描的正方形边长(默认等于20) x1,y1 扫描范围坐标,参数可省略(默认等于 1 X 1) x2,y2 扫描范围坐标2,参数可省略(默认等于屏幕大小) */ rectInvolute = function(step,n,x1,y1,x2,y2){ step = step or 1; step = math.abs(step); step = 0 - math.abs(step); n = n or 20; x1 = x1 or 1; y1 = y1 or 1; if(! ( x2 and y2) ) { x2,y2 = getScreenWidthHeight() } var fx,fy = 1,1; if(x1