public int taxi_distance( c_vector other) { return(Math.Abs(x - other.x) + Math.Abs(y - other.y) + Math.Abs(z - other.z)); }
public c_vector add(c_vector other) { return(new c_vector( x + other.x, y + other.y, z + other.z)); }
public static c_matrix scale(c_vector s) { c_matrix result = identity(); result.values[0, 0] *= s.x; result.values[1, 1] *= s.y; result.values[2, 2] *= s.z; return(result); }
public static c_matrix translate(c_vector t) { c_matrix result = identity(); result.values[0, 3] += t.x; result.values[1, 3] += t.y; result.values[2, 3] += t.z; return(result); }
public c_vector multiply(c_vector vector) { // applies the current operation to the inputted vector. c_vector result = new c_vector(); result.x = vector.x * this.values[0, 0] + vector.y * this.values[0, 1] + vector.z * this.values[0, 2] + this.values[0, 3]; result.y = vector.x * this.values[1, 0] + vector.y * this.values[1, 1] + vector.z * this.values[1, 2] + this.values[1, 3]; result.z = vector.x * this.values[2, 0] + vector.y * this.values[2, 1] + vector.z * this.values[2, 2] + this.values[2, 3]; return(result); }
public bool equal_to(c_vector other) { return(x == other.x && y == other.y && z == other.z); }
public c_vector(c_vector other) { x = other.x; y = other.y; z = other.z; }