Compare commits
No commits in common. "b7727d6aa36cba355b68a25203e1711fa222ff29" and "77aabf61c52b0ff0ad43b9279626c396005cf107" have entirely different histories.
b7727d6aa3
...
77aabf61c5
@ -35,7 +35,7 @@ Benchmark Iterations Min(ns) Max(ns) Variance Mean(ns)
|
|||||||
full(0) 100 119354512 731397135 3705581696928414 125714847
|
full(0) 100 119354512 731397135 3705581696928414 125714847
|
||||||
```
|
```
|
||||||
|
|
||||||
Mean difference is `3ms 522µs 206ns (-2.7%)`, min difference is `5ms 493µs 883ns (-4.4%)`
|
Mean difference is `3ms 522µs 206ns`, min difference is `5ms 493µs 883ns`.
|
||||||
|
|
||||||
This suggests that given driver is suboptimal in its optimizing capabilities,
|
This suggests that given driver is suboptimal in its optimizing capabilities,
|
||||||
and I imagine there might be GLSL compilers a lot worse than this.
|
and I imagine there might be GLSL compilers a lot worse than this.
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
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