so... jai :D

This commit is contained in:
agra
2026-02-04 01:34:30 +02:00
commit 55fc5790e4
60 changed files with 15876 additions and 0 deletions

17
examples/modules/math.sx Normal file
View File

@@ -0,0 +1,17 @@
#import "std.sx";
dot :: (a: Vector(3,f32), b: Vector(3,f32)) -> f32 {
return a.x*b.x + a.y*b.y + a.z*b.z;
}
cross :: (a: Vector(3,f32), b: Vector(3,f32)) -> Vector(3,f32) {
.[a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x];
}
length :: (v: Vector(3,f32)) -> f32 {
return sqrt(dot(v, v));
}
normalize :: (v: Vector(3,f32)) -> Vector(3,f32) {
return v / length(v);
}