xyz, precomputed sqrt(3)

This commit is contained in:
Tenari
2026-04-16 08:06:42 -05:00
parent c17a8bfbd0
commit 842a1f8718
2 changed files with 16 additions and 0 deletions
+10
View File
@@ -364,6 +364,12 @@ typedef struct Box {
u32 width; u32 width;
} Box; } Box;
typedef struct XYZ {
i32 x;
i32 y;
i32 z;
} XYZ;
typedef struct Dim2 { typedef struct Dim2 {
u16 height; u16 height;
u16 width; u16 width;
@@ -545,6 +551,9 @@ global const u8 MAX_u8 = 0xff;
#ifndef PI #ifndef PI
#define PI (3.14159265358979323846) #define PI (3.14159265358979323846)
#endif #endif
#ifndef SQRT_3
# define SQRT_3 (1.7320508076)
#endif
///// CUSTOM ENTRY POINT ///// CUSTOM ENTRY POINT
/* TODO? /* TODO?
@@ -556,6 +565,7 @@ fn b32 update(void);
*/ */
///// MATH ///// MATH
fn bool xyzEq(XYZ a, XYZ b);
fn Range1u64 range1u64Create(u64 min, u64 max); fn Range1u64 range1u64Create(u64 min, u64 max);
fn Range1u64 mRangeFromNIdxMCount(u64 n_idx, u64 n_count, u64 m_count); fn Range1u64 mRangeFromNIdxMCount(u64 n_idx, u64 n_count, u64 m_count);
fn void u32Quicksort(u32 arr[], u32 low, u32 high); fn void u32Quicksort(u32 arr[], u32 low, u32 high);
+6
View File
@@ -1,5 +1,11 @@
#include "all.h" #include "all.h"
fn bool xyzEq(XYZ a, XYZ b) {
return a.x == b.x &&
a.y == b.y &&
a.z == b.z;
}
fn Range1u64 range1u64Create(u64 min, u64 max) { fn Range1u64 range1u64Create(u64 min, u64 max) {
Range1u64 result = { Range1u64 result = {
.min = min, .min = min,