MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / is_colinear

Function is_colinear

python/pymesh/meshutils/face_utils.py:4–22  ·  view source on GitHub ↗

Return true if ``v0``, ``v1`` and ``v2`` are colinear. Colinear check is done using exact predicates. Args: v0 (``numpy.ndarray``): vector of size 2 or 3. v1 (``numpy.ndarray``): vector of size 2 or 3. v2 (``numpy.ndarray``): vector of size 2 or 3. Return:

(v0, v1, v2)

Source from the content-addressed store, hash-verified

2import numpy as np
3
4def is_colinear(v0, v1, v2):
5 """ Return true if ``v0``, ``v1`` and ``v2`` are colinear.
6 Colinear check is done using exact predicates.
7
8 Args:
9 v0 (``numpy.ndarray``): vector of size 2 or 3.
10 v1 (``numpy.ndarray``): vector of size 2 or 3.
11 v2 (``numpy.ndarray``): vector of size 2 or 3.
12
13 Return:
14 A boolean indicating whether ``v0``, ``v1`` and ``v2`` are colinear.
15 """
16 dim = len(v0)
17 if dim == 2:
18 return PyMesh.is_colinear_2D(v0, v1, v2)
19 elif dim == 3:
20 return PyMesh.is_colinear_3D(v0, v1, v2)
21 else:
22 raise NotImplementedError("Supported dimention {}".format(dim))
23
24def get_degenerated_faces_raw(vertices, faces):
25 """ Return indices of degenerated faces.

Callers

nothing calls this directly

Calls 3

NotImplementedErrorClass · 0.85
is_colinear_2DMethod · 0.80
is_colinear_3DMethod · 0.80

Tested by

no test coverage detected