getComponent method
-
index - 0, 1 or 2.
-
If index equals 0 returns the x value.
-
If index equals 1 returns the y value.
-
If index equals 2 returns the z value.
Implementation
double getComponent(int index) {
switch (index) {
case 0:
return x;
case 1:
return y;
case 2:
return z;
default:
throw ('index is out of range: $index');
}
}