math + constants

This commit is contained in:
Tenari
2026-07-07 07:59:17 -05:00
parent 13158f8362
commit 8ba557ec63
2 changed files with 27 additions and 0 deletions
+5
View File
@@ -1,4 +1,5 @@
#include "all.h"
#include <math.h>
fn bool xyzEq(XYZ a, XYZ b) {
return a.x == b.x &&
@@ -90,6 +91,10 @@ fn Vec2f32 vec2Subtract(Vec2 a, Vec2 b) {
return result;
}
fn f32 vec2Distance(Vec2 a, Vec2 b) {
return sqrtf((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
fn Vec2f32 vec2FromHexCube(Vec2 map_center, XYZ cube, f32 size, f32 border_thickness) {
f32 hex_height = SQRT_3 * size;
f32 hex_width = 2.0 * size;