var Camera = new Class({
	initialize: function(c, O, e){
		this.c = c; // the location of the camera.
		this.O = O; // rotation of the camera
		this.e = e; // the viewer's position relative to the display surface
	},
	transform: function(a){
		var O = this.O,
			c = this.c,
			e = this.e;
		var sOy = sin(O.y),
			cOy = cos(O.y),
			sOz = sin(O.z),
			cOz = cos(O.z),
			sOx = sin(O.x),
			cOx = cos(O.x);
		
		var tmpA = (cOy * (a.z - c.z) + sOy * (sOz * (a.y - c.y) + cOz * (a.x - c.x)));
		var tmpB = (cOz * (a.y - c.y) - sOz * (a.x - c.x));
		
		var d = {
			x: cOy * (sOz * (a.y - c.y) + cOz * (a.x - c.x)) - sOy * (a.z - c.z),
			y: sOx * tmpA + cOx * tmpB,
			z: cOx * tmpA - sOx * tmpB
		};
		return { // the 2D projection of a.
			x: - (d.x - e.x) * (e.z / d.z),
			y: (d.y - e.y) * (e.z / d.z)
		};
	}
});

var cam = new Camera(
	{x: .3, y: 0, z: -5},
	{x: 0, y: 0, z:  0},
	{x: 0, y: 0, z:  -2});
