随笔分类 - 计算几何
acm设计竞赛计算几何
摘要: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...
阅读全文
摘要: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){ ...
阅读全文
摘要://计算几何误差修正 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...
阅读全文
摘要://计算几何误差修正 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(...
阅读全文