-
Notifications
You must be signed in to change notification settings - Fork 182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow selection and picking of surfaces with triangle strips #757
Labels
good first issue
Good for newcomers
Comments
Hi @Garyfallidis, where is the update 10.3.2023 |
Hi @Garyfallidis , I need some help.. import numpy as np
from fury import actor, window, pick, utils
scene = window.Scene()
lines = [np.random.rand(10, 3), 10 * np.random.rand(20, 3)]
colors = np.random.rand(2, 3)
streamtube_actor = actor.streamtube(lines, colors)
rgba = 255 * np.ones((100, 200, 4))
rgba[1:-1, 1:-1] = np.zeros((98, 198, 4))+100
texa = actor.texture_2d(rgba.astype(np.uint8))
scene.add(streamtube_actor)
scene.add(texa)
scene.reset_camera()
scene.zoom(3.)
showm = window.ShowManager(scene, size=(1024, 768),
order_transparent=True,
reset_camera=False)
selm = pick.SelectionManager(select='faces')
selm.selectable_off(texa)
vcolors = utils.colors_from_actor(streamtube_actor, 'colors')
def hover_callback(_obj, _event):
event_pos = selm.event_position(showm.iren)
# updates rectangular box around mouse
texa.SetPosition(event_pos[0] - 200//2,
event_pos[1] - 100//2)
# defines selection region and returns information from selected objects
info = selm.select(event_pos, showm.scene, (200//2, 100//2))
for node in info.keys():
if info[node]['face'] is not None:
if info[node]['actor'] is streamtube_actor:
for face_index in info[node]['face']:
color_change = np.array([150, 0, 0], dtype='uint8')
vcolors[face_index] \
= color_change
utils.update_actor(streamtube_actor)
showm.render()
showm.add_iren_callback(hover_callback)
interactive = True
if interactive:
showm.start() |
Is this issue resolved? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently the SelectionManager works as expected for selecting triangle representations of surfaces.
However when we have surfaces represented with triangle strips we need to be more careful and find the correct triangle indices from the strips.
To see the issue you can start by modifying the
viz_selection.py
tutorial and add actors that use strips such as streamtube and then try to select those and start debugging the issue.The text was updated successfully, but these errors were encountered: