getOrdinate method
Gets the ordinate value for the given index.
The base implementation supports values for the index are {@link X}, {@link Y}, and {@link Z}.
@param ordinateIndex the ordinate index @return the value of the ordinate @throws IllegalArgumentException if the index is not valid
Implementation
double getOrdinate(int ordinateIndex) {
switch (ordinateIndex) {
case X:
return x;
case Y:
return y;
case Z:
return getZ(); // sure to delegate to subclass rather than offer direct field access
}
throw new ArgumentError("Invalid ordinate index: $ordinateIndex");
}