摘要: const Point=require('./Point') const Line=require('./Line') //多边形类 function Polygon(a) { if(this instanceof Polygon){ this.n=a.length; this.a=a; }else{ if(a.every(func... 阅读全文
posted @ 2019-03-14 16:51 无工时代 阅读(227) 评论(0) 推荐(0) 编辑
摘要: const Point=require('./Point') //计算几何线段类 function Line(a,b) { if(this instanceof Line){ this.a=a; this.b=b; }else{ if(a instanceof Point&&b instanceof Point){ ... 阅读全文
posted @ 2019-03-14 16:08 无工时代 阅读(170) 评论(0) 推荐(0) 编辑
摘要: //计算几何误差修正 Math.EPS=0.00000001; //判断x的符号 Math.cmp=function(x) { if(Math.abs(x)0){ return 1; }else{ return -1; } } //计算几何点类 function Point(x,y) { if(this instanceof Poi... 阅读全文
posted @ 2019-03-14 13:25 无工时代 阅读(229) 评论(0) 推荐(0) 编辑
摘要: //计算几何误差修正 Math.EPS=0.00000001; //判断x的符号 Math.cmp=function(x) { if(Math.abs(x)0){ return 1; }else{ return -1; } } console.log(Math.cmp(0.1+0.2-0.3)) console.log(Math.cmp(... 阅读全文
posted @ 2019-03-14 11:03 无工时代 阅读(227) 评论(0) 推荐(0) 编辑