/***************************************************************************
	Point - Point object.
	
	A point in 2D Cartesian space.
	
	Version:
		v0.1, Monday, July 08, 2002
	
	Requires:
		Nothing
		
	Author:
		Alexander Whillas

	Copyright (C) 2002 Taylor Square Designs
***************************************************************************/

// Constructor
function Point (p_left, p_top) {
	this.x = p_left || 0;
	this.y = p_top || 0;
	
	return this;
}

// Makes the Points x/y equal to the given Points x/y.
Point.prototype.setEqualTo = function (p_point) {
	this.x = p_point.x;
	this.y = p_point.y;

	return true;
}

// Comparison operator. Compare this point to another point.
Point.prototype.isEqualTo = function (p_point) {
	return (this.x == p_point.x && this.y == p_point.y);
}

// The distance in pixes of this point to the one given.
Point.prototype.distanceTo = function (p_point) {
	with (Math) {
		return sqrt( pow((this.x - p_point.x), 2) + pow((this.y - p_point.y), 2) );
	}
}

// Representative string.
Point.prototype.toString = function () {
	return "x:" + this.x + " y:" + this.y;
}

Point.prototype.getX = function () {
	return this.x;
}

Point.prototype.getY = function () {
	 return this.y;
}

Point.prototype.setX = function (p_x) {
	this.x = p_x;
}

Point.prototype.setY = function (p_y) {
	this.y = p_y;
}

Point.prototype.moveBy = function (p_x, p_y) {
	this.x += p_x;
	this.y += p_y;
}