Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Use symmetric HexTile cell coordinates on CPU and GPU

sanyamsingh0019bcf2e2dfd95
diff --cc crates/effects/src/stylize3.rs
index 403c325cd,403c325cd..e28f9a4fa
--- a/crates/effects/src/stylize3.rs
+++ b/crates/effects/src/stylize3.rs
@@@ -351,7 -351,7 +351,7 @@@ fn hex_cell(x: f64, y: f64, r: f64) ->
let rr = (2.0 / 3.0 * y) / r;
// Cube rounding.
let (cx, cz) = (q, rr);
-- let cy = -cx - cz;
++ let cy = (-3f64.sqrt() / 3.0 * x - y / 3.0) / r;
let (mut rx, ry, mut rz) = (cx.round(), cy.round(), cz.round());
let (dx, dy, dz) = ((rx - cx).abs(), (ry - cy).abs(), (rz - cz).abs());
if dx > dy && dx > dz {