1function Point(x, y){ 2 this.x = x || 0; 3 this.y = y || 0; 4}; 5Point.prototype.x = null; 6Point.prototype.y = null; 7Point.prototype.add = function(v){ 8 return new Point(this.x + v.x, this.y + v.y); 9}; 10Point.prototype.clone = function(){ 11 return new Point(this.x, this.y); 12}; 13Point.prototype.degreesTo = function(v){ 14 var dx = this.x - v.x; 15 var dy = this.y - v.y; 16 var angle = Math.atan2(dy, dx); // radians 17 return angle * (180 / Math.PI); // degrees 18}; 19Point.prototype.distance = function(v){ 20 var x = this.x - v.x; 21 var y = this.y - v.y; 22 return Math.sqrt(x * x + y * y); 23}; 24Point.prototype.equals = function(toCompare){ 25 return this.x == toCompare.x && this.y == toCompare.y; 26}; 27Point.prototype.interpolate = function(v, f){ 28 return new Point( v.x + (this.x - v.x) * f, v.y + (this.y - v.y) * f ); 29}; 30Point.prototype.length = function(){ 31 return Math.sqrt(this.x * this.x + this.y * this.y); 32}; 33Point.prototype.normalize = function(thickness){ 34 var l = this.length(); 35 this.x = this.x / l * thickness; 36 this.y = this.y / l * thickness; 37}; 38Point.prototype.orbit = function(origin, arcWidth, arcHeight, degrees){ 39 var radians = degrees * (Math.PI / 180); 40 this.x = origin.x + arcWidth * Math.cos(radians); 41 this.y = origin.y + arcHeight * Math.sin(radians); 42}; 43Point.prototype.offset = function(dx, dy){ 44 this.x += dx; 45 this.y += dy; 46}; 47Point.prototype.subtract = function(v){ 48 return new Point(this.x - v.x, this.y - v.y); 49}; 50Point.prototype.toString = function(){ 51 return "(x=" + this.x + ", y=" + this.y + ")"; 52}; 53 54Point.interpolate = function(pt1, pt2, f){ 55 return pt1.interpolate(pt2, f); 56}; 57Point.polar = function(len, angle){ 58 return new Point(len * Math.cos(angle), len * Math.sin(angle)); 59}; 60Point.distance = function(pt1, pt2){ 61 var x = pt1.x - pt2.x; 62 var y = pt1.y - pt2.y; 63 return Math.sqrt(x * x + y * y); 64};
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.