rapidsai / node

GPU-accelerated data science and visualization in node
https://rapidsai.github.io/node/
Apache License 2.0
187 stars 20 forks source link

Write a `particles` visualization demo using point-in-polygon #439

Open thomcom opened 2 years ago

thomcom commented 2 years ago

We've been planning for a while to build a pip demo that uses index buffer objects and a viewport specified as a polygon for pip culling. This issue describes that project:

A web application is loaded that queries the api-server GPU backend to load a dataset onto GPU.

The api-server uses @rapidsai/cudf to load a large number of x,y point coordinates and metadata into a cudf.DataFrame.

The client app then queries for the points that contained in the current viewport and displays them.

It receives mouse events for scrolling and dragging that change the perspective on the displayed points, with a background image (or map) that translates and scales to match the GL geometry.

Whenever the perspective changes, the client requests an updated set of points from the original datasource, passing the current viewport coordinates to be used as a polygon.

api-server uses the viewport coordinates to cull the points with point-in-polygon before returning them over arrow.

https://github.com/rapidsai/node/issues/439#tasklist-block-78cf1f58-34c6-4e7b-a261-11ff5477a1f8

thomcom commented 2 years ago

The particles demo is displaying a NAD database of points on top of a Google Earth background image as texture. The app requests the data points from api-server and displays them.

Once i am happy with the reference coordinate systems, the app will be modified to hit a new api-server endpoint whenever there is a re-render event: after a zoom event and after a drag event. It was necessary to fix the coordinate system reference points before doing this because the new screen viewport will be projected into world coordinates, then those world coordinates will be passed to the server to request the new set of viewport-culled display points.

Then I will add the viewport culling api endpoint to the server which will use a new Polygon produced from the lon/lat viewport coordinates, call point-in-polygon on the resident DataFrame, and return 93k or a larger number of points to the client for display.

thomcom commented 2 years ago

An important item I remembered during our weekly meeting is that the server presently has a terrible memory leak. If I use the full dataset of 67m points the server crashes after only 2-3 restarts.