-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtesting2.py
62 lines (47 loc) · 1.07 KB
/
testing2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import pyvista as pv
import numpy as np
import ctypes as ct
from cutil import *
verts = np.array([
# target curve
[0, 0, 0],
[0, 0, 1],
[0, 0, 2],
[0, 0, 3],
[0, 0.5, 4],
[0, 1, 5],
[0, 1, 6],
# anomaly
[0.25, 0, 1],
[0.5, 0, 2],
[0.25, 0, 3],
])
ref_verts = np.array([
# reference curve
[1, 0, 0],
[1, 0, 1],
[1, 0, 2],
[1, 0, 3],
[1, 0.5, 4],
[1, 1, 5],
[1, 1, 6],
])
conn = np.array([
# target line
7, 0, 1, 2, 3, 4, 5, 6,
# anomaly line
5, 0, 7, 8, 9, 4,
# null terminator
0
], dtype=np.int32)
ref_conn: np.ndarray = np.array([
7, 0, 1, 2, 3, 4, 5, 6, 0
], dtype=np.int32)
target = pv.PolyData(verts, lines=conn)
reference = pv.PolyData(ref_verts, lines=ref_conn)
plotter = pv.Plotter()
_ = plotter.add_mesh(target, color='blue', render_points_as_spheres=True,
point_size=1, show_vertices=True)
_ = plotter.add_mesh(reference, color='red', render_points_as_spheres=True,
point_size=1, show_vertices=True)
plotter.show(cpos='xy')