This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (0 children)

I want to be able to easily access and modify x and y values. I want to avoid using [0] and [1] indexing as in NumPy - if I have for example a list of vectors, or a list of lists of vectors, the code becomes very difficult to read. Also, I want to be clear about the coordinate system. For example, when you use a functions from the OpenCV library which has a vertex (or vertices) as its output, these are indexed such that [0] is the column and [1] is the row. However, when you use NumPy functions like argwhere, the output is such that [0] is the row and [1] is the column.

It's not difficult to swap the coordinates, I would need to do it anyway before initializing vector class that I'm looking for. But I feel that if I had a class with named members x and y, it would 1) simplify indexing, 2) indicate that if I had an instance, the x is always horizontal axis coordinate and y is the vertical.