It depends, of course, on the semantics that the user of your function would expect, based on the domain. With lat1, long1, lat2, long2
you’re essentially taking two points: lat1, long1
and lat2, long2
.
*-(lat1, long1) --+
| |
| |
+-- -* (lat2, long2)
Whereas with lat1, lat2, long1, long2
, you’re taking 4 axis bounds: the top, bottom, left, and right. I’ve never seen this before, but I can imagine it might be common in some domains, or for example when using interval arithmetic.
| |
-+---------lat1--------+-
| |
| |
long1 long2
| |
| |
-+---------lat2--------+-
| |
I don’t know how Matlab deals with types, but in a conventional imperative language I would expect functions to take arguments of more descriptive types, for example:
Info rect_info(Point top_left, Point bottom_right)
Info area_info(Range vertical, Range horizontal)
It’s also worth considering terminology. Two arbitrary numbers are not necessarily a Point
, but you can represent a Point
with them—if your API takes numbers when it wants points, then you’re exposing implementation details to the user. You could go a step further—two arbitrary Point
s are not necessarily a Rectangle
, and two arbitrary Range
s are not necessarily an Area
.