summaryrefslogtreecommitdiff
path: root/src/vec.zig
diff options
context:
space:
mode:
authorTom Barrett <tom@tombarrett.xyz>2022-12-24 18:31:35 +0100
committerTom Barrett <tom@tombarrett.xyz>2022-12-24 18:31:35 +0100
commit39b57fa0729d16873193947b12e59a7da52695fa (patch)
tree2c10fa22ab5f27e4db80732aa55166e42ffc7de6 /src/vec.zig
parent8ab21b7ec6bd83fe12b48534e4f670500e8d5e2c (diff)
more ziglike
Diffstat (limited to 'src/vec.zig')
-rw-r--r--src/vec.zig16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/vec.zig b/src/vec.zig
index cc245a4..b98f9f4 100644
--- a/src/vec.zig
+++ b/src/vec.zig
@@ -1,25 +1,25 @@
-pub const vec = @Vector(3, f32);
+pub const Vec = @Vector(3, f32);
-pub fn init(x: f32, y: f32, z: f32) vec {
+pub fn init(x: f32, y: f32, z: f32) Vec {
return @Vector(3, f32){ x, y, z };
}
-pub fn scalar(x: f32) vec {
+pub fn scalar(x: f32) Vec {
return @splat(3, x);
}
-pub fn unit_vector(v: vec) vec {
+pub fn unitVec(v: Vec) Vec {
return v / scalar(length(v));
}
-pub fn length_squared(v: vec) f32 {
+pub fn lengthSquared(v: Vec) f32 {
return v[0] * v[0] + v[1] * v[1] + v[2] * v[2];
}
-pub fn length(v: vec) f32 {
- return @sqrt(length_squared(v));
+pub fn length(v: Vec) f32 {
+ return @sqrt(lengthSquared(v));
}
-pub fn dot(x: vec, y: vec) f32 {
+pub fn dot(x: Vec, y: Vec) f32 {
return x[0] * y[0] + x[1] * y[1] + x[2] * y[2];
}