1/* masalygin 0.0.1 */ 2'use strict'; 3 4(function(factory) { 5 6 if (typeof define === 'function' && define.amd) { 7 8 define([], factory); 9 10 } else { 11 12 factory(); 13 14 } 15 16})(function() { 17 18 function Line(a, b) { 19 this.a = a; 20 this.b = b; 21 } 22 23 Line.prototype.len = function() { 24 var dx = this.a.x - this.b.x, 25 dy = this.a.y - this.b.y; 26 27 return Math.sqrt(dx * dx + dy * dy); 28 }; 29 30 function Triangle(a, b, c) { 31 this.a = a; 32 this.b = b; 33 this.c = c; 34 } 35 36 Triangle.prototype.square = function() { 37 var ab = (new Line(this.a, this.b)).len(), 38 bc = (new Line(this.b, this.c)).len(), 39 ac = (new Line(this.a, this.c)).len(), 40 p = (ab + bc + ac) / 2; 41 42 return Math.sqrt(p * (p - ab) * (p - bc) * (p - ac)); 43 }; 44 45 Triangle.prototype.hasPoint = function(p, d) { 46 var abp = (new Triangle(this.a, this.b, p)).square(), 47 acp = (new Triangle(this.a, this.c, p)).square(), 48 bcp = (new Triangle(this.b, this.c, p)).square(), 49 sum = abp + acp + bcp, 50 dS = Math.abs(sum - this.square()); 51 52 d = (typeof d === 'undefined') ? 0 : d; 53 54 if (dS < d) { 55 return true; 56 } else { 57 return false; 58 } 59 }; 60 61 window.s3Math = { 62 Line: Line, 63 Triangle: Triangle 64 }; 65 66 return window.s3Math; 67 68});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.