Skip to content

Commit 7a873f3

Browse files
committed
[ENH] Improving orientations visibility
1 parent f0e4da2 commit 7a873f3

File tree

1 file changed

+42
-6
lines changed

1 file changed

+42
-6
lines changed

gempy_viewer/modules/plot_3d/drawer_input_3d.py

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ def plot_orientations(
9696
surface_points: SurfacePointsTable,
9797
arrows_factor: float,
9898
element_colors=None,
99+
arrow_scale_mode='fixed', # 'fixed' or 'vector'
100+
arrow_opacity=1.0,
101+
show_arrow_outline=True,
102+
outline_color='white',
103+
outline_width=1,
99104
):
100105
orientations_xyz = orientations.xyz
101106
orientations_grads = orientations.grads
@@ -113,18 +118,49 @@ def plot_orientations(
113118
poly['id'] = vectorize_ids
114119
poly['vectors'] = orientations_grads
115120

116-
arrows = poly.glyph(
117-
orient='vectors',
118-
scale=False,
119-
factor=arrows_factor,
120-
)
121+
# Determine scaling mode
122+
if arrow_scale_mode == 'vector':
123+
# Scale arrows by their magnitude
124+
arrows = poly.glyph(
125+
orient='vectors',
126+
scale='vectors',
127+
factor=arrows_factor,
128+
)
129+
else:
130+
# Fixed scale (original behavior)
131+
arrows = poly.glyph(
132+
orient='vectors',
133+
scale=False,
134+
factor=arrows_factor,
135+
)
136+
137+
# Optional: Add outlined arrows for better visibility
138+
if show_arrow_outline:
139+
# Create a slightly larger version for the outline
140+
arrows_outline = poly.glyph(
141+
orient='vectors',
142+
scale=False if arrow_scale_mode == 'fixed' else 'vectors',
143+
factor=arrows_factor
144+
)
145+
146+
# Add outline FIRST (behind)
147+
gempy_vista.p.add_mesh(
148+
mesh=arrows_outline,
149+
color=outline_color,
150+
style='wireframe', # This is the key!
151+
line_width=outline_width,
152+
opacity=arrow_opacity,
153+
)
121154

155+
# Add main colored arrows SECOND (in front)
122156
gempy_vista.orientations_actor = gempy_vista.p.add_mesh(
123157
mesh=arrows,
124158
scalars='id',
125159
show_scalar_bar=False,
126160
cmap=(ListedColormap(element_colors)),
127-
clim=(-0.5, np.unique(surface_points.ids).shape[0] + .5)
161+
clim=(-0.5, np.unique(surface_points.ids).shape[0] + .5),
162+
opacity=arrow_opacity,
163+
smooth_shading=True,
128164
)
129165
gempy_vista.orientations_mesh = arrows
130166

0 commit comments

Comments
 (0)