I tend to work with Nx2 arrays representing coordinate geometry.
I have examined a number of packages and there is no guidelines as to why a 
certain arrangement is preferred over the other.
For example:  a rectangle, coordinates ordered clockwise with the first and 
last the same to ensure closure of the geometry

as a numpy ndarray
array([[  0.00,   0.00],
          [  0.00,   2.00],
          [  8.00,   2.00],
          [  8.00,   0.00],
          [  0.00,   0.00]])

same, but just ravelled
array([  0.00,   0.00,   0.00,   2.00,   8.00,   2.00,   8.00,   0.00,   0.00,  
 0.00])

How about a T

array([[  0.00,   0.00,   8.00,   8.00,   0.00],
          [  0.00,   2.00,   2.00,   0.00,   0.00]])

and of course there are the python  list equivalents of the above.

Preference/history seems to be the only guiding principle as to one chooses a 
certain coordinate layout over another.
Nx2 for 2D coordinates makes sense to me ( eg X, Y graphs,  Longitude, Latitude)

If I were to profer a reason to another person why I chose a particular format 
over another other than "works for me", would there be any other guiding 
considerations?

In general I:
- work with the coordinates as a pair
- sometimes, just the 'X' or 'Y'
- I save the values to disk on occasion so I can recover a particular entity 
without having to recreate it.

Curious... since I also worked with 3D coordinates (X, Y, Z as position and 
elevation) but I am considering working with temporal representation of 2D and 
3D data.  This is still ndim=2, but adding time as a the 3rd dimension

array([[[  0.00,   0.00],   # locations at time 0
           [  0.00,   2.00],
           [  8.00,   2.00],
           [  8.00,   0.00],
           [  0.00,   0.00]],

       [[ 10.00,  10.00],   # locations at time 2, shifted by 10, 10 in X, and Y
        [ 10.00,  12.00],
        [ 18.00,  12.00],
        [ 18.00,  10.00],
        [ 10.00,  10.00]]])
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to