Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
@visx/delaunay
Advanced tools
A Voronoi diagram partitions a two-dimensional plane into regions based on a set of input points. Each unique input point maps to a corresponding region, where each region represents all points that are closer to the input point than to any other input point.
Not only are Voronoi diagrams 😍, but they can be used to improve the interactive experience of a visualization. This is most often accomplished by overlaying an invisible voronoi grid on top of the visualization to increase the target area of interaction sites such as points on a scatter plot.
The @visx/delaunay
package provides a wrapper around the existing
d3-delaunay package with some react
-specific utilities.
npm install --save @visx/delaunay
The @visx/delaunay
package exports a wrapped version of the d3 voronoi
and delaunay
layouts for flexible usage,
as well as a <Polygon />
component for rendering Voronoi and Delaunay regions.
import { voronoi, Polygon } from '@visx/delaunay';
const points = Array(n).fill(null).map(() => ({
x: Math.random() * innerWidth,
y: Math.random() * innerHeight,
}));
// width + height set an extent on the voronoi
// x + y set relevant accessors depending on the shape of your data
const voronoiDiagram = voronoi({
data: points,
x: d => d.x,
y: d => d.y,
width,
height,
});
const polygons = Array.from(voronoiDiagram.cellPolygons());
return (
<svg>
<Group>
{polygons.map((polygon) => (
<Polygon key={...} polygon={polygon} />
))}
{points.map(({ x, y }) => (
<circle key={...} cx={x} cy={y} />
)}
</Group>
</svg>
)
Additional information about the voronoi diagram API can be found in the d3-delaunay documentation.
FAQs
visx delaunay
The npm package @visx/delaunay receives a total of 10,922 weekly downloads. As such, @visx/delaunay popularity was classified as popular.
We found that @visx/delaunay demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.