Compare commits
2 Commits
77aabf61c5
...
b7727d6aa3
Author | SHA1 | Date | |
---|---|---|---|
|
b7727d6aa3 | ||
|
3d89ab8ce6 |
@ -35,7 +35,7 @@ Benchmark Iterations Min(ns) Max(ns) Variance Mean(ns)
|
||||
full(0) 100 119354512 731397135 3705581696928414 125714847
|
||||
```
|
||||
|
||||
Mean difference is `3ms 522µs 206ns`, min difference is `5ms 493µs 883ns`.
|
||||
Mean difference is `3ms 522µs 206ns (-2.7%)`, min difference is `5ms 493µs 883ns (-4.4%)`
|
||||
|
||||
This suggests that given driver is suboptimal in its optimizing capabilities,
|
||||
and I imagine there might be GLSL compilers a lot worse than this.
|
||||
|
35
articles/incremental-delaunay/page.mmd
Normal file
35
articles/incremental-delaunay/page.mmd
Normal file
@ -0,0 +1,35 @@
|
||||
Title: Optimized Incremental Delaunay
|
||||
Brief: Classic triangulation algorithm to use for one by one insertion of points, with SIMD and caching.
|
||||
Date: 1694711563
|
||||
Tags: Programming, Zig, Generation
|
||||
CSS: /style.css
|
||||
|
||||
![](/articles/incremental-delaunay/web.png)
|
||||
|
||||
Based on [this paper](https://www.cs.umd.edu/class/spring2020/cmsc754/Lects/lect13-delaun-alg.pdf)
|
||||
|
||||
Full usable isolated code is [here](/articles/incremental-delaunay/incremental-delaunay.zig.txt).
|
||||
|
||||
### Usage example ###
|
||||
```zig
|
||||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
||||
defer std.debug.assert(gpa.deinit() == .ok);
|
||||
var triangulator = try Delaunay.Builder.init(gpa.allocator(), Delaunay.Area{-1, -1, 1, 1});
|
||||
|
||||
const point_count = 128;
|
||||
|
||||
var prng = std.rand.DefaultPrng.init(123123);
|
||||
const rng = prng.random();
|
||||
for (0..point_count) |_| {
|
||||
const x = rng.float(f32) * 2 - 1;
|
||||
const y = rng.float(f32) * 2 - 1;
|
||||
try triangulator.insertAtRandom(Delaunay.Vertex{ x, y }, rng);
|
||||
}
|
||||
|
||||
var triangles: [point_count * 2 + 2]gfx.triangle.ScreenspaceTriangle = undefined;
|
||||
for (&triangles, triangulator.triangles.items) |*out, in| {
|
||||
out.a = triangulator.vertices.items[in.points[0]];
|
||||
out.b = triangulator.vertices.items[in.points[1]];
|
||||
out.c = triangulator.vertices.items[in.points[2]];
|
||||
}
|
||||
```
|
Loading…
Reference in New Issue
Block a user