Sorry, something went wrong.
| rectangle-.2.mp4 |
Sorry, something went wrong.
| rectangle_selection.mp4 |
Sorry, something went wrong.
|
I wonder if a method that returns a mask and then using the mask for get_selected_data() could be useful, since it is about 20% faster: In [20]: %%timeit
...: a[(a > 50_000) & (a < 100_000)]
...:
...:
620 μs ± 7.79 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
In [21]: %%timeit
...: a[np.where((a > 50_000) & (a < 100_000))]
...:
...:
747 μs ± 31.6 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)
|
Sorry, something went wrong.
| ) | ||
|
|
||
| for vertex in self.vertices: | ||
| vertex.world.z = -0.25 |
There was a problem hiding this comment.
why -0.25 🤔
Sorry, something went wrong.
There was a problem hiding this comment.
the edges get set to -0.5, so if the vertices are -0.25 then they will be on top of the edges
Sorry, something went wrong.
There was a problem hiding this comment.
how does this scale with rectangle size and camera zoom?
Sorry, something went wrong.
There was a problem hiding this comment.
what do you mean?
Sorry, something went wrong.
There was a problem hiding this comment.
Sometimes world objects will have weird overlapping when the z-planes are close with very high or very low zoom, I just tried it and it seems fine within reasonable levels.
Sorry, something went wrong.
There was a problem hiding this comment.
Wondering if you tried the selector with different offsets for the parent graphic, does it return the correct selection, and correct arrays for get_selected_indices() and get_selected_data().
Sorry, something went wrong.
| ) | ||
|
|
||
| for vertex in self.vertices: | ||
| vertex.world.z = -0.25 |
There was a problem hiding this comment.
how does this scale with rectangle size and camera zoom?
Sorry, something went wrong.
|
For collection a helper method that gets indices or returns graphics under the selection could be useful. Not hard to implement currently, we can think about and add more helper functions later 😄 line_collection = figure[0, 0].add_line_collection(circles, cmap="jet", thickness=5)
rs = line_collection.add_rectangle_selector()
@rs.add_event_handler("selection")
def bah(ev):
line_collection.cmap = "jet"
ixs = ev.get_selected_indices()
# iterate through each of the selected indices, if the array size > 0 that mean it's under the selection
selected_line_ixs = [i for i in range(len(ixs)) if ixs[i].size > 0]
line_collection[selected_line_ixs].colors = "w"
rectangle_selector-2024-08-08_23.43.52.mp4
|
Sorry, something went wrong.
| ) | ||
|
|
||
| for vertex in self.vertices: | ||
| vertex.world.z = -0.25 |
There was a problem hiding this comment.
Sometimes world objects will have weird overlapping when the z-planes are close with very high or very low zoom, I just tried it and it seems fine within reasonable levels.
Sorry, something went wrong.
|
Chiming in here because Kushal showed this to me IRL yesterday. Pretty cool!!!! I had two comments:
Keep it going. I love to see these demos! |
Sorry, something went wrong.
#142 Rectangle selector