jc/math/module.jai
2025-09-07 15:25:57 -06:00

42 lines
1 KiB
Text

#module_parameters(
UNITS: enum { radians; degrees; turns; } = .turns,
RECT_TYPE: Type = float,
// RECT_METHOD: enum { dimension; absolute; } = absolute, // Note(Jesse): Maybe at a later point we can do this
RUN_TESTS := false
);
#assert TypeIsScalar(RECT_TYPE);
#load "common.jai";
#load "vec.jai";
#load "mat.jai";
#load "ease.jai";
#load "shape.jai";
#scope_module;
#import "jc";
math :: #import "Math"; // @future
basic :: #import "Basic"; // @future
// @temp(judah): move these to the right files
v2_eq :: (a: Vec2, b: Vec2) -> bool {
return float_eq(a.x, b.x) && float_eq(a.y, b.y);
}
v3_eq :: (a: Vec3, b: Vec3) -> bool {
return float_eq(a.x, b.x) && float_eq(a.y, b.y) && float_eq(a.z, b.z);
}
v4_eq :: (a: Vec4, b: Vec4) -> bool {
return float_eq(a.x, b.x) && float_eq(a.y, b.y) && float_eq(a.z, b.z) && float_eq(a.w, b.w);
}
// Smallest difference where a float is basically that value
EPSILON :: 0.001;
float_eq :: (f: float, with: float) -> bool {
return f > with - EPSILON && f < with + EPSILON;
}