+#define ClipVelocity(in, normal, out, overbounce) \
+ (out = vec_epsilon(vec_reflect(in, normal, (overbounce) - 1), 0.1))
+
+#ifdef GAMEQC
+ ERASEABLE
+ vector get_corner_position(entity box, int corner)
+ {
+ switch (corner)
+ {
+ case 1: return vec3(box.absmin.x, box.absmin.y, box.absmin.z);
+ case 2: return vec3(box.absmax.x, box.absmin.y, box.absmin.z);
+ case 3: return vec3(box.absmin.x, box.absmax.y, box.absmin.z);
+ case 4: return vec3(box.absmin.x, box.absmin.y, box.absmax.z);
+ case 5: return vec3(box.absmax.x, box.absmax.y, box.absmin.z);
+ case 6: return vec3(box.absmin.x, box.absmax.y, box.absmax.z);
+ case 7: return vec3(box.absmax.x, box.absmin.y, box.absmax.z);
+ case 8: return vec3(box.absmax.x, box.absmax.y, box.absmax.z);
+ default: return '0 0 0';
+ }
+ }
+
+ ERASEABLE
+ vector NearestPointOnBox(entity box, vector org)
+ {
+ vector m1 = box.mins + box.origin;
+ vector m2 = box.maxs + box.origin;
+
+ return vec3(
+ bound(m1.x, org.x, m2.x),
+ bound(m1.y, org.y, m2.y),
+ bound(m1.z, org.z, m2.z)
+ );
+ }