File tree Expand file tree Collapse file tree 2 files changed +46
-3
lines changed Expand file tree Collapse file tree 2 files changed +46
-3
lines changed Original file line number Diff line number Diff line change 11from ._surface import Surface
22from ._bounding_box import BoundingBox
3+ from ._point import ValuePoints , VectorPoints
Original file line number Diff line number Diff line change 1- # from dataclasses import dataclass
1+ from dataclasses import dataclass
2+ import numpy as np
23
34
4- # @dataclass
5- # class Value:
5+ @dataclass
6+ class ValuePoints :
7+ locations : np .ndarray
8+ values : np .ndarray
9+ name : str
10+
11+ def to_dict (self ):
12+ return {
13+ "locations" : self .locations ,
14+ "values" : self .values ,
15+ "name" : self .name ,
16+ }
17+
18+ def vtk (self ):
19+ import pyvista as pv
20+
21+ points = pv .PolyData (self .locations )
22+ points ["values" ] = self .values
23+ return points
24+
25+
26+ @dataclass
27+ class VectorPoints :
28+ locations : np .ndarray
29+ vectors : np .ndarray
30+ name : str
31+
32+ def to_dict (self ):
33+ return {
34+ "locations" : self .locations ,
35+ "vectors" : self .vectors ,
36+ "name" : self .name ,
37+ }
38+
39+ def vtk (self ):
40+ import pyvista as pv
41+
42+ points = pv .PolyData (self .locations )
43+ points .point_data .set_vectors (self .vectors , 'vectors' )
44+ geom = pv .Arrow ()
45+
46+ # Perform the glyph
47+ return points .glyph (orient = "vectors" , geom = geom )
You can’t perform that action at this time.
0 commit comments