对Math对象的扩展
* 函数名称:
* 参数说明:
* 功能说明:对Math对象的扩展
* 使用说明: 1、重写后的数学三角函数的参数不再是弧度,而是角度
* 2、Math.Radian(),将角度转换为弧度
* 3、Math.Angel(),将弧度转换为角度
* 4、Math.Sin(),计算角度的正弦
* 5、Math.Cin(),计算角度的余弦
* 6、Math.Tan(),计算角度的正切
* 7、Math.Pol(),通过x,y坐标计算距离和角度
* 7、Math.Rec(),通过距离和角度计算坐标
-*/
Math.Radian = function( angel ) { return angel*this.PI/180; }
Math.Angel = function( radian ) { return radian*180/this.PI; }
Math.Sin = function( angel ) { return this.sin( this.Radian( angel ) ); }
Math.Asin = function( nums ) { return this.Angel( this.asin( nums ) ); }
Math.Cos = function( angel ) { return this.cos( this.Radian( angel ) ); }
Math.Acos = function( nums ) { return this.Angel( this.acos( nums ) ); }
Math.Tan = function( angel ) { return this.tan( this.Radian( angel ) ); }
Math.Atan = function( nums ) { return this.Angel( this.atan( nums ) ); }
Math.Atan2 = function( x, y ) { return this.Angel( this.atan2( y, x ) ); }
Math.Pol = function( x, y ) { return [ this.sqrt( x*x + y*y ), this.Atan2( x, y ) ]; }
Math.Rec = function( dist, angel ) { return [ dist*this.Cos( angel ), dist*this.Sin( angel ) ];
浙公网安备 33010602011771号