aboutsummaryrefslogtreecommitdiffstats
path: root/gb_math.h
diff options
context:
space:
mode:
authorGravatar Ginger Bill 2017-08-23 21:02:22 +0100
committerGravatar Ginger Bill 2017-08-23 21:02:22 +0100
commit7bba49ce13e807fbc34458652e39c28e78af1089 (patch)
tree9df971feb55cfc25e78fdb5cb2937318b82c8fb8 /gb_math.h
parentFix issue #21 (diff)
Update gb.h to v0.31
Diffstat (limited to 'gb_math.h')
-rw-r--r--gb_math.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/gb_math.h b/gb_math.h
index 4b17453..62f84f4 100644
--- a/gb_math.h
+++ b/gb_math.h
@@ -483,7 +483,10 @@ GB_MATH_DEF void gb_quat_squad_approx(gbQuat *d, gbQuat p, gbQuat a, gbQuat b, g
/* Rects */
GB_MATH_DEF gbRect2 gb_rect2(gbVec2 pos, gbVec2 dim);
+GB_MATH_DEF gbRect2 gb_rect2v(float v[4]);
+
GB_MATH_DEF gbRect3 gb_rect3(gbVec3 pos, gbVec3 dim);
+GB_MATH_DEF gbRect3 gb_rect3v(float v[6]);
GB_MATH_DEF int gb_rect2_contains (gbRect2 a, float x, float y);
GB_MATH_DEF int gb_rect2_contains_vec2 (gbRect2 a, gbVec2 p);
@@ -2025,6 +2028,13 @@ gbRect2 gb_rect2(gbVec2 pos, gbVec2 dim) {
return r;
}
+gbRect2 gb_rect2v(float v[4]) {
+ gbRect2 r;
+ r.pos = gb_vec2v(&v[0]);
+ r.dim = gb_vec2v(&v[2]);
+ return r;
+}
+
gbRect3 gb_rect3(gbVec3 pos, gbVec3 dim) {
gbRect3 r;
r.pos = pos;
@@ -2032,6 +2042,14 @@ gbRect3 gb_rect3(gbVec3 pos, gbVec3 dim) {
return r;
}
+gbRect3 gb_rect3v(float v[6]) {
+ gbRect3 r;
+ r.pos = gb_vec3v(&v[0]);
+ r.dim = gb_vec3v(&v[3]);
+ return r;
+}
+
+
int gb_rect2_contains(gbRect2 a, float x, float y) {
float min_x = gb_min(a.pos.x, a.pos.x+a.dim.x);
float max_x = gb_max(a.pos.x, a.pos.x+a.dim.x);