// Point object function Point(x,y) { this.x=x; this.y=y; } // Contour object function Contour(a) { this.pts = []; // an array of Point objects defining the contour } // ...add points to the contour... Contour.prototype.area = function() { var area=0; var pts = this.pts; var nPts = pts.length; var j=nPts-1; var p1; var p2; for (var i=0;i