summaryrefslogtreecommitdiff
path: root/2026/games_submissions/asrael_io/source/src/math.rs
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2026-08-26 23:47:59 -0400
committerLLLL Colonq <llll@colonq>2026-08-26 23:47:59 -0400
commit0d2d8cd897e94bd94e0b3ae7c6ce9aa580a44a0a (patch)
treee9039d1c3aedca515d6cb499451d4b73aca4f5fd /2026/games_submissions/asrael_io/source/src/math.rs
parent242943e5b023ce40eb3be826c418a478d4672f78 (diff)
Add a_tension_span
Diffstat (limited to '2026/games_submissions/asrael_io/source/src/math.rs')
-rw-r--r--2026/games_submissions/asrael_io/source/src/math.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/2026/games_submissions/asrael_io/source/src/math.rs b/2026/games_submissions/asrael_io/source/src/math.rs
new file mode 100644
index 0000000..371f165
--- /dev/null
+++ b/2026/games_submissions/asrael_io/source/src/math.rs
@@ -0,0 +1,13 @@
+use glam::Vec2;
+
+pub fn aabb(a_pos: Vec2, a_size: Vec2, b_pos: Vec2, b_size: Vec2) -> bool {
+ a_pos.x < b_pos.x + b_size.x
+ && b_pos.x < a_pos.x + a_size.x
+ && a_pos.y < b_pos.y + b_size.y
+ && b_pos.y < a_pos.y + a_size.y
+}
+
+pub fn bezier(p: [Vec2; 4], t: f32) -> Vec2 {
+ let u = 1.0 - t;
+ u * u * u * p[0] + 3.0 * u * u * t * p[1] + 3.0 * u * t * t * p[2] + t * t * t * p[3]
+}