plot icon indicating copy to clipboard operation
plot copied to clipboard

Voronoi initializer (for pointer interactions)

Open Fil opened this issue 2 years ago • 6 comments

new description!

This PR chiefly addresses #1622, making the voronoi mark work with the tip option. A notable performance issue in the modified usStateCapitalsVoronoi test is that the clip path is created anew each time we rerender the mark (this is addressed separately, in #1624).

A secondary issue (#1858, making voronoi work with exclusive facets) was first addressed in an ad hoc fashion (in https://github.com/observablehq/plot/pull/1623/commits/71c49a2178bc8eb40db547f83665ac4087d3fe80). After this review comment suggesting that this should be centralized, I reverted the change in https://github.com/observablehq/plot/pull/1623/commits/70f23521a4deb48ab34726398e833b540d4b9580, then used the new exclusiveFacets transform (introduced in #1648) in https://github.com/observablehq/plot/pull/1623/commits/972558cdee4fcfb1f04e20411664f92006a93940 et sq.

Closes #1622 Closes #1858.

Fil avatar May 23 '23 20:05 Fil

I couldn’t resist trying the Voronoi initializer idea… I dunno if we need to make similar changes to the Delaunay marks? I think maybe it doesn’t make sense there, though, because there’s a not a 1:1 correspondence between the data and the geometry.

https://github.com/observablehq/plot/assets/230541/067c54b5-801f-49cb-bea7-fabf355a0c3c

mbostock avatar May 24 '23 02:05 mbostock

the voronoi cell now depends on i and fi (with a test showing facet: exclude)

Fil avatar May 24 '23 03:05 Fil

~~It works!~~ ~~Applying the exclusiveFacets to the voronoi mark only for now (I saw that it didn't work with the voronoiMesh).~~

Fil avatar Aug 21 '23 08:08 Fil

~~In the documentation there is a voronoi mark with the centroid initializer, and the reindexation logic fails in that case.~~

Fil avatar Aug 21 '23 08:08 Fil

~~I'm not sure how to apply exclusiveFacets properly. At least we now have test cases. Rather than a transform as it is now, I wonder if it could be a (private?) option flag instead, that asks Plot to apply this before any other transform. It would feel less "ad hoc" for the voronoi marks.~~

Fil avatar Aug 21 '23 09:08 Fil

I've updated the description of this PR. ~~I'd like to find a cleaner way to apply the exclusiveFacets transform~~ (DONE)

Fil avatar Sep 13 '23 22:09 Fil