GeezerVison is showing github.com — Plot area nearest graphics method · Issue #514 · fastplotlib/fastplotlib
Plot area nearest graphics method #514
Description
A method on plot area that returns the nearest n graphics could be useful. Just get world bounding sphere of all graphics and return closest in order.. Will need to see if this is fast enough. We could cache the world bounding spheres and update them whenever graphic data, offset or rotation changes.
Activity
kushalkolar commented on Jun 8, 2024
If it's slow, we could store the bounding sphere of a graphic when it's added to a PlotArea and update it whenever data, offset, or rotation changes. We could have a config option on each graphic to enable/disable this because updating all these could be slow if for example the data of a line collection is being constantly changed in a live data stream.
clewis7 commented on Jun 16, 2024
the nearest graphics relative to what?
clewis7 commented on Jun 16, 2024
I think we should provide option for "edge" vs "center" and choose one as the default (prob "center" imo)
kushalkolar commented on Jun 17, 2024
the nearest graphics relative to what?
to a passed point in world space
idea of current signature:
def get_nearest_graphics(
self,
pos: tuple[float, float, float],
n_graphics: int = None,
method: str = "center",
subset: tuple[Graphic] = None,
) -> tuple[Graphic]:
"""
Returns the nearest ``n_graphics`` to the passed position ``pos`` in world space
Parameters
----------
pos: (x, y, z)
position in world space, not data space
n_graphics: int | None
nearest number of graphics to return, if ``None`` returns all graphics
method: "center" | "edge"
determine the nearest objects using the "center" of graphics or the "edge"
Returns
-------
tuple[Graphic]
nearest graphics to ``pos`` in order
"""
pass
Metadata
Metadata
Development
No branches or pull requestsIssue actions