diff options
author | Tyler Murphy <tylerm@tylerm.dev> | 2023-04-22 21:47:58 -0400 |
---|---|---|
committer | Tyler Murphy <tylerm@tylerm.dev> | 2023-04-22 21:47:58 -0400 |
commit | f56f28c7218f465f4ad5579a6b0fe0f41ea13fd5 (patch) | |
tree | d96cd6845c56f9fd68cad404422bf4512ffbfc49 /src/ray.h | |
parent | move raycastign to its own file (diff) | |
download | raycaster-f56f28c7218f465f4ad5579a6b0fe0f41ea13fd5.tar.gz raycaster-f56f28c7218f465f4ad5579a6b0fe0f41ea13fd5.tar.bz2 raycaster-f56f28c7218f465f4ad5579a6b0fe0f41ea13fd5.zip |
collision
Diffstat (limited to 'src/ray.h')
-rw-r--r-- | src/ray.h | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -3,6 +3,14 @@ #include <stdbool.h> #include <stdint.h> +#define PI 3.14159265358979323846 +#define PIH 1.57079632679489661923 +#define PI2 6.28318530718 + +#define sign(a) ((a) < 0 ? -1 : 1) +#define min(a, b) ((a) < (b) ? (a) : (b)) +#define max(a, b) ((a) > (b) ? (a) : (b)) + typedef struct { float x, y; } v2; @@ -11,10 +19,9 @@ typedef struct { int x, y; } v2i; - float v2_cross(v2 a, v2 b); float v2_len(v2 a); +float v2_dist(v2 a, v2 b); float v2_square_dist(v2 a, v2 b); -v2 v2_add(v2 a, v2 b); uint32_t cast_ray(v2 pos, float theta, v2* hit_pos); |