Repository: magpylib/magpylib

Issue:
Wrong direction of Line currents
**Describe the bug**
Line currents seem to show wrong directions in some situations

**To Reproduce**

```python
import magpylib as magpy
import numpy as np

current = 10
vert1=np.array([
    [-500,-500,-500],
    [-500,500,-500],
    [-500,500,500],
    [-500,-500,500],
    [-500,-500,-500],
])
vert2 = vert1 + np.array((1000,0,0))
l1 = magpy.current.Line(current=current,vertices=vert1)
l2 = magpy.current.Line(current=current,vertices=vert2)

c = magpy.Collection(l1, l2)
c.display(backend='matplotlib')
```

**Expected behavior**
All arrows should flow in the same direction

**Screenshots**
![image](https://user-images.githubusercontent.com/29252289/145952400-7322ba2c-d416-4ae4-839a-7b9f87b22981.png)

**Additional context**
current development branch 8c3050d0fd0ef9111b237bd543bcc8991db9d3f5

Discussion:
codecov-commenter: # [Codecov](https://codecov.io/gh/magpylib/magpylib/pull/430?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=magpylib) Report
> Merging [#430](https://codecov.io/gh/magpylib/magpylib/pull/430?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=magpylib) (178f98c) into [development](https://codecov.io/gh/magpylib/magpylib/commit/29fc06b77a86fe5708c527e736008b3a0b6d70ab?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=magpylib) (29fc06b) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/magpylib/magpylib/pull/430/graphs/tree.svg?width=650&height=150&src=pr&token=CUMIRUhr1P&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=magpylib)](https://codecov.io/gh/magpylib/magpylib/pull/430?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=magpylib)

```diff
@@             Coverage Diff              @@
##           development     #430   +/-   ##
============================================
  Coverage        99.74%   99.74%           
============================================
  Files               46       46           
  Lines             4732     4734    +2     
============================================
+ Hits              4720     4722    +2     
  Misses              12       12           
```


| [Impacted Files](https://codecov.io/gh/magpylib/magpylib/pull/430?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=magpylib) | Coverage Δ | |
|---|---|---|
| [magpylib/\_src/display/disp\_utility.py](https://codecov.io/gh/magpylib/magpylib/pull/430/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=magpylib#diff-bWFncHlsaWIvX3NyYy9kaXNwbGF5L2Rpc3BfdXRpbGl0eS5weQ==) | `100.00% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/magpylib/magpylib/pull/430?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=magpylib).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=magpylib)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/magpylib/magpylib/pull/430?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=magpylib). Last update [29fc06b...178f98c](https://codecov.io/gh/magpylib/magpylib/pull/430?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=magpylib). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=magpylib).


Patch:
diff --git a/magpylib/_src/display/disp_utility.py b/magpylib/_src/display/disp_utility.py
index e45ce47a..dd18e77d 100644
--- a/magpylib/_src/display/disp_utility.py
+++ b/magpylib/_src/display/disp_utility.py
@@ -31,15 +31,22 @@ def place_and_orient_model3d(
     return {**model_dict, xyz[0]: x, xyz[1]: y, xyz[2]: z, **kwargs}
 
 
-def draw_arrow(vec, pos, sign=1, arrow_size=1) -> Tuple:
+def draw_arrowed_line(vec, pos, sign=1, arrow_size=1) -> Tuple:
     """
     Provides x,y,z coordinates of an arrow drawn in the x-y-plane (z=0), showing up the y-axis and
     centered in x,y,z=(0,0,0). The arrow vertices are then turned in the direction of `vec` and
     moved to position `pos`.
     """
+    norm = np.linalg.norm(vec)
+    nvec = np.array(vec) / norm
+    yaxis = np.array([0, 1, 0])
+    cross = np.cross(nvec, yaxis)
+    dot = np.dot(nvec, yaxis)
+    n = np.linalg.norm(cross)
+    if dot==-1:
+        sign *= -1
     hy = sign * 0.1 * arrow_size
     hx = 0.06 * arrow_size
-    norm = np.linalg.norm(vec)
     arrow = (
         np.array(
             [
@@ -54,11 +61,6 @@ def draw_arrow(vec, pos, sign=1, arrow_size=1) -> Tuple:
         )
         * norm
     )
-    nvec = np.array(vec) / norm
-    yaxis = np.array([0, 1, 0])
-    cross = np.cross(nvec, yaxis)
-    dot = np.dot(nvec, yaxis)
-    n = np.linalg.norm(cross)
     if n != 0:
         t = np.arccos(dot)
         R = RotScipy.from_rotvec(-t * cross / n)
@@ -73,7 +75,7 @@ def draw_arrow_from_vertices(vertices, current, arrow_size):
     positions = vertices[:-1] + vectors / 2
     vertices = np.concatenate(
         [
-            draw_arrow(vec, pos, np.sign(current), arrow_size=arrow_size)
+            draw_arrowed_line(vec, pos, np.sign(current), arrow_size=arrow_size)
             for vec, pos in zip(vectors, positions)
         ],
         axis=1,


Test patch:
diff --git a/tests/test_display_utility.py b/tests/test_display_utility.py
new file mode 100644
index 00000000..214686dc
--- /dev/null
+++ b/tests/test_display_utility.py
@@ -0,0 +1,28 @@
+import numpy as np
+from magpylib._src.display.disp_utility import draw_arrow_from_vertices
+
+def test_draw_arrow_from_vertices():
+    """tests also the edge case when a vertex is in -y direction"""
+    vertices = np.array([
+        [-1.,  1.,  1.],
+        [-1., -1.,  1.],
+        [-1., -1., -1.],
+        [-1.,  1., -1.],
+        [-1.,  1.,  1.]
+    ])
+    result = draw_arrow_from_vertices(vertices, current=1, arrow_size=1)
+    expected = np.array([
+        [-1.  , -1.  , -1.12, -1.  , -0.88, -1.  , -1.  , -1.  , -1.  ,
+        -1.12, -1.  , -0.88, -1.  , -1.  , -1.  , -1.  , -1.12, -1.  ,
+        -0.88, -1.  , -1.  , -1.  , -1.  , -1.12, -1.  , -0.88, -1.  ,
+        -1.  ],
+       [-1.  ,  0.  ,  0.2 ,  0.  ,  0.2 ,  0.  ,  1.  , -1.  , -1.  ,
+        -1.  , -1.  , -1.  , -1.  , -1.  , -1.  ,  0.  , -0.2 ,  0.  ,
+        -0.2 ,  0.  ,  1.  ,  1.  ,  1.  ,  1.  ,  1.  ,  1.  ,  1.  ,
+         1.  ],
+       [ 1.  ,  1.  ,  1.  ,  1.  ,  1.  ,  1.  ,  1.  ,  1.  ,  0.  ,
+         0.2 ,  0.  ,  0.2 ,  0.  , -1.  , -1.  , -1.  , -1.  , -1.  ,
+        -1.  , -1.  , -1.  , -1.  ,  0.  , -0.2 ,  0.  , -0.2 ,  0.  ,
+         1.  ]
+    ])
+    assert np.allclose(result, expected), 'draw arrow from vertices failed'