double getComponent(int i) { switch (i) { case 0: return x; case 1: return y; case 2: return z; default: throw 'No component at index $i on a vector3'; } }