Point.js
资源名称:WorkFlow.rar [点击查看]
上传用户:ahit0551
上传日期:2009-04-15
资源大小:2345k
文件大小:1k
源码类别:
xml/soap/webservice
开发平台:
Java
- /**
- * <p>Title: </p>
- * <p>Description: </p>
- * <p>Copyright: Copyright (c) xio.name 2006</p>
- * @author xio
- */ function Point(x, y) { this.setX(x); this.setY(y); } Point.prototype.clone = function () { return new Point(this.x, this.y); }; Point.prototype.toString = function () { return "Point[" + this.getX() + "," + this.getY() + "]"; }; Point.prototype.setX = function (x) { this.x = x; }; Point.prototype.getX = function () { return this.x; }; Point.prototype.setY = function (y) { this.y = y; }; Point.prototype.getY = function () { return this.y; }; Point.prototype.distance = function (oPoint) { return Math.sqrt(Math.pow(this.getX() - oPoint.getX(), 2) + Math.pow(this.getY() - oPoint.getY(), 2)); };