I'm mainly thinking of x,y coordinates but I guess 3D coordinates and higher also apply.
Let's say I'm writing a function to return the center of a rectangle given its width and height. Which is the more logically correct out of
center(width, height) {
return {
x: width / 2,
y: height / 2
};
}
and
center(dimensions) {
return {
x: dimensions.width / 2,
y: dimensions.height / 2
};
}
?
I know in reality both ways would be fine... but logically, should coordinates or dimensions be thought of as one item or many?