Point Obect

function Point (x,y,z)
{
    this.x = (x == undefined)? 0: x;
    this.y = (y == undefined)? 0: y;
    this.z = (z == undefined)? 0: z;

    this.reset = function () {
        this.x = 0;
        this.y = 0;
        return this;
    }
    this.move = function (x,y) {
        this.x = x;
        this.y = y;
        return this;
    }
    this.magnitude = function () {
        var a = (this.x * this.x);
        var b = (this.y * this.y);
        var c = (this.z * this.z);
        return Math.sqrt(a+b);
    }
    this.toString = function () {
        return '['+ this.x +','+ this.y +']';
    }
}