package lib; import lib.Vec.Vec3; /** Reporesents a Point in a 3D `Int` System. Basicly a wrapper for Vec3 with some extra functions. `Y` represents the height of the point. **/ @:forward(x,y,z) abstract Pos3(Vec3) from Vec3 to Vec3{ inline public function new(i:Vec3) { this = i; } @:op(A + B) public function add(rhs: Vec3):Pos3 { return new Pos3({ y: this.y + rhs.y, x: this.x + rhs.x, z: this.z + rhs.z }); } @:op(A - B) public function sub(rhs: Vec3):Pos3 { return new Pos3({ y: this.y - rhs.y, x: this.x - rhs.x, z: this.z - rhs.z }); } @:op(A * B) public function multiply(rhs: Vec3): Pos3 { return new Pos3({ y: this.y * rhs.y, x: this.x * rhs.x, z: this.z * rhs.z }); } @:op(-A) public function negate(): Pos3 { return new Pos3({ y: -this.y, x: -this.x, z: -this.z }); } }