flatten-js
Version:
Javascript library for 2d geometry
1 lines • 3.35 kB
JSON
{"dependencies":[{"name":"C:\\Users\\alexbol\\WebstormProjects\\flatten-js\\package.json","includedInParent":true,"mtime":1520238055570}],"generated":{"js":"var t=function(){function t(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,\"value\"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(n,e,i){return e&&t(n.prototype,e),i&&t(n,i),n}}();function n(t,n){if(!(t instanceof n))throw new TypeError(\"Cannot call a class as a function\")}module.exports=function(e){e.Point=function(){function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;n(this,i),this.x=Number.isNaN(t)?0:t,this.y=Number.isNaN(e)?0:e}return t(i,[{key:\"clone\",value:function(){return new e.Point(this.x,this.y)}},{key:\"equalTo\",value:function(t){return e.Utils.EQ(this.x,t.x)&&e.Utils.EQ(this.y,t.y)}},{key:\"lessThan\",value:function(t){return!!e.Utils.LT(this.y,t.y)||!(!e.Utils.EQ(this.y,t.y)||!e.Utils.LT(this.x,t.x))}},{key:\"rotate\",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{x:0,y:0},i=n.x+(this.x-n.x)*Math.cos(t)-(this.y-n.y)*Math.sin(t),o=n.y+(this.x-n.x)*Math.sin(t)+(this.y-n.y)*Math.cos(t);return new e.Point(i,o)}},{key:\"translate\",value:function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];if(1==n.length&&n[0]instanceof e.Vector)return new e.Point(this.x+n[0].x,this.y+n[0].y);if(2==n.length&&\"number\"==typeof n[0]&&\"number\"==typeof n[1])return new e.Point(this.x+n[0],this.y+n[1]);throw e.Errors.ILLEGAL_PARAMETERS}},{key:\"projectionOn\",value:function(t){if(this.equalTo(t.pt))return this.clone();var n=new e.Vector(this,t.pt);if(e.Utils.EQ_0(n.cross(t.norm)))return t.pt.clone();var i=n.dot(t.norm),o=t.norm.multiply(i);return this.translate(o)}},{key:\"leftTo\",value:function(t){var n=new e.Vector(t.pt,this);return e.Utils.GT(n.dot(t.norm),0)}},{key:\"distanceTo\",value:function(t){var n=e.Distance;if(t instanceof i){var o=t.x-this.x,r=t.y-this.y;return[Math.sqrt(o*o+r*r),new e.Segment(this,t)]}return t instanceof e.Line?n.point2line(this,t):t instanceof e.Circle?n.point2circle(this,t):t instanceof e.Segment?n.point2segment(this,t):t instanceof e.Arc?n.point2arc(this,t):t instanceof e.Polygon?n.point2polygon(this,t):t instanceof e.PlanarSet?n.shape2planarSet(this,t):void 0}},{key:\"on\",value:function(t){return t instanceof e.Point?this.equalTo(t):t instanceof e.Line?t.contains(this):t instanceof e.Circle?t.contains(this):t instanceof e.Segment?t.contains(this):t instanceof e.Arc?t.contains(this):t instanceof e.Polygon?t.contains(this):void 0}},{key:\"svg\",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{r:\"5\",stroke:\"black\",strokeWidth:\"1\",fill:\"red\"},n=t.r,e=t.stroke,i=t.strokeWidth,o=t.fill;return'\\n<circle cx=\"'+this.x+'\" cy=\"'+this.y+'\" r=\"'+n+'\" stroke=\"'+e+'\" stroke-width=\"'+i+'\" fill=\"'+o+'\" />'}},{key:\"box\",get:function(){return new e.Box(this.x,this.y,this.x,this.y)}},{key:\"vertices\",get:function(){return[this.clone()]}}]),i}(),e.point=function(){for(var t=arguments.length,n=Array(t),i=0;i<t;i++)n[i]=arguments[i];return new(Function.prototype.bind.apply(e.Point,[null].concat(n)))}};"},"hash":"022adad23a3b8bd62eaa1d7360c960a3","cacheData":{"env":{}}}