class position { #x; #y; #z; constructor(x = 0, y = 0, z = 0) { this.x = x; this.y = y; this.z = z; } set x(target) { if (typeof(target) !== "number") { throw new TypeError("X cord must be an number."); } this.#x = target; } set y(target) { if (typeof(target) !== "number") { throw new TypeError("Y cord must be an number."); } this.#y = target; } set z(target) { if (typeof(target) !== "number") { throw new TypeError("Z cord must be an number."); } this.#z = target; } get x() { return this.#x; } get y() { return this.#y; } get z() { return this.#z; } compare(target) { if (!(target instanceof position)) { throw new TypeError("Can only compare position with position."); } const result = new position(); result.x = target.x - this.x; result.y = target.y - this.y; result.z = target.z - this.z; return result; } } export { position };