pixienator
Helpers for visualizing delaunator with pixie.
Summary
| Latest Version | 20230610 |
|---|---|
| License | Unlicense |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:25 |
Tags
Authors
- patternspandemic
Installation
nimble install pixienator
choosenim install pixienator
git clone https://github.com/patternspandemic/pixienator
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| pixienator | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Dependencies
| Package | Version | Optional |
|---|---|---|
| nim >= 1.6.12", "pixie >= 5.0.6", "delaunator >= | 20230610 | No |
Source
| Repository | https://github.com/patternspandemic/pixienator |
|---|---|
| Homepage | https://github.com/patternspandemic/pixienator |
| Registry Source | nimble_official |
README
Pixienator
Helpers for visualizing Delaunator with Pixie.
nimble install pixienator
API Reference - A work in progress.
Features
- Path generating templates for various parts of the Delaunator datastructure.
Example
import std/[random, sugar]
import delaunator, delaunator/helpers, pixie, pixienator
var
width = 300
height = 300
image = newImage(width, height)
# Generate a normal distribution of 20 points.
siteCount = 20
normalPoints = collect(newSeq):
for i in 1 .. siteCount: [gauss(width.float64 / 2.0, width.float64 / 6.0), gauss(height.float64 / 2.0, height.float64 / 6.0)]
# Create the dual graph.
d = delaunator.fromPoints[array[2, float64], float64](normalPoints)
# Clip infinite regions to match our image size.
d.bounds = (0.0, 0.0, width.float64, height.float64)
let # Use some Pixienator helpers to generate Pixie Paths:
triangulation = pathForTriangleEdges(d)
voronoi = pathsForRegions(d)
# Color each region.
for i, region in voronoi.pairs:
image.fillPath(region, spin(color(1.0, 0.0, 1.0), i.float64 * (360.float64 / voronoi.len.float64)))
# Draw the triangulation on top.
image.strokePath(triangulation, "black")
image.writeFile("example.png")
