
function Vector3(x, y, z){
	this.x = x;
	this.y = y;
	this.z = z;
}

Vector3.prototype.getLength = function(){
	return Math.sqrt(this.x*this.x + this.y*this.y + this.z*this.z)
}

Vector3.prototype.getNormalized = function(){
	var length = this.getLength();
	var normalized = new Vector3(0,0,0);
	normalized.x = this.x / length;
	normalized.y = this.y / length;
	normalized.z = this.z / length;
	
	return normalized;
}

Vector3.prototype.addVector = function(vector){
	var vec = new Vector3(this.x + vector.x, this.y + vector.y, this.z + vector.z);
	
	return vec;
}

Vector3.prototype.mulScalar = function(scalar){
	var vec = new Vector3(this.x *scalar, this.y *scalar, this.z *scalar);
	
	return vec;
}

Vector3.prototype.toString = function(){
	return this.x + ", " + this.y + ", " + this.z;
}
